private void expectMessageStartingWith(String start) {
delegate.expectMessage(StringStartsWith.startsWith(format(start)));
}
java类org.hamcrest.core.StringStartsWith的实例源码
ExpectedException.java 文件源码
项目:assertj-vavr
阅读 23
收藏 0
点赞 0
评论 0
ConnectionTest.java 文件源码
项目:cito
阅读 27
收藏 0
点赞 0
评论 0
@Test
public void toString_() {
assertThat(this.connection.toString(), new StringStartsWith(Connection.class.getName() + "@"));
assertThat(this.connection.toString(), new StringEndsWith("[sessionId=ABC123]"));
}
SessionTest.java 文件源码
项目:cito
阅读 18
收藏 0
点赞 0
评论 0
@Test
public void toString_() {
assertThat(this.session.toString(), new StringStartsWith(Session.class.getName() + "@"));
assertThat(this.session.toString(), new StringEndsWith("[connection=conn,session=delegate]"));
}
TrafficCountImporterTest.java 文件源码
项目:TomboloDigitalConnector
阅读 17
收藏 0
点赞 0
评论 0
@Test
public void testImportDatasourceUnknown() throws Exception{
thrown.expect(ConfigurationException.class);
thrown.expectMessage(new StringStartsWith("Unknown DatasourceId:"));
importer.importDatasource("xyz", null, null, null);
}
TrafficCountImporterTest.java 文件源码
项目:TomboloDigitalConnector
阅读 19
收藏 0
点赞 0
评论 0
@Test
public void testImportDatasourceNowhere() throws Exception {
thrown.expect(ConfigurationException.class);
thrown.expectMessage(new StringStartsWith("Missing geography scope"));
importer.importDatasource("trafficCounts", null, null, null);
}
TrafficCountImporterTest.java 文件源码
项目:TomboloDigitalConnector
阅读 24
收藏 0
点赞 0
评论 0
@Test
public void testImportDatasourceNorthPole() throws Exception {
thrown.expect(ConfigurationException.class);
thrown.expectMessage(new StringStartsWith("Unknown Geography Scope:"));
importer.importDatasource("trafficCounts", Arrays.asList("North Pole"), null, null);
}
PlainProviderTest.java 文件源码
项目:FHIR-Server
阅读 21
收藏 0
点赞 0
评论 0
@Test
public void testGlobalHistory() throws Exception {
GlobalHistoryProvider provider = new GlobalHistoryProvider();
myRestfulServer.setProviders(provider);
myServer.start();
String baseUri = "http://localhost:" + myPort + "/fhir/context";
HttpResponse status = myClient.execute(new HttpGet(baseUri + "/_history?_since=2012-01-02T00%3A01%3A02&_count=12"));
String responseContent = IOUtils.toString(status.getEntity().getContent());
IOUtils.closeQuietly(status.getEntity().getContent());
ourLog.info("Response was:\n{}", responseContent);
assertEquals(200, status.getStatusLine().getStatusCode());
Bundle bundle = myCtx.newXmlParser().parseBundle(responseContent);
assertEquals(3, bundle.getEntries().size());
assertThat(provider.myLastSince.getValueAsString(), StringStartsWith.startsWith("2012-01-02T00:01:02"));
assertThat(provider.myLastCount.getValueAsString(), IsEqual.equalTo("12"));
status = myClient.execute(new HttpGet(baseUri + "/_history?&_count=12"));
responseContent = IOUtils.toString(status.getEntity().getContent());
IOUtils.closeQuietly(status.getEntity().getContent());
assertEquals(200, status.getStatusLine().getStatusCode());
bundle = myCtx.newXmlParser().parseBundle(responseContent);
assertEquals(3, bundle.getEntries().size());
assertNull(provider.myLastSince.getValueAsString());
assertThat(provider.myLastCount.getValueAsString(), IsEqual.equalTo("12"));
status =myClient.execute(new HttpGet(baseUri + "/_history?_since=2012-01-02T00%3A01%3A02"));
responseContent = IOUtils.toString(status.getEntity().getContent());
IOUtils.closeQuietly(status.getEntity().getContent());
assertEquals(200, status.getStatusLine().getStatusCode());
bundle = myCtx.newXmlParser().parseBundle(responseContent);
assertEquals(3, bundle.getEntries().size());
assertThat(provider.myLastSince.getValueAsString(), StringStartsWith.startsWith("2012-01-02T00:01:02"));
assertNull(provider.myLastCount.getValueAsString());
status =myClient.execute(new HttpGet(baseUri + "/_history"));
responseContent = IOUtils.toString(status.getEntity().getContent());
IOUtils.closeQuietly(status.getEntity().getContent());
assertEquals(200, status.getStatusLine().getStatusCode());
bundle = myCtx.newXmlParser().parseBundle(responseContent);
assertEquals(3, bundle.getEntries().size());
assertNull(provider.myLastSince.getValueAsString());
assertNull(provider.myLastCount.getValueAsString());
}
FormAPIConnectionTest.java 文件源码
项目:paymenthighway-java-lib
阅读 20
收藏 0
点赞 0
评论 0
static String postCardFormAndReturnLastQueryString(
String serviceUrl,
String formUri,
String cardNumber,
String expirationMonth,
String expirationYear,
String cvc
) {
HttpPost httpPost = new HttpPost(serviceUrl + formUri);
List<NameValuePair> submitParameters = new ArrayList<>();
submitParameters.add(new BasicNameValuePair("card_number", cardNumber));
submitParameters.add(new BasicNameValuePair("expiration_month", expirationMonth));
submitParameters.add(new BasicNameValuePair("expiration_year", expirationYear));
submitParameters.add(new BasicNameValuePair("cvv", cvc));
httpPost.addHeader("Content-Type", "application/x-www-form-urlencoded");
httpPost.addHeader("User-Agent", "PaymentHighway Java Lib");
String submitResponse = null;
HttpClientContext context = null;
try {
httpPost.setEntity(new UrlEncodedFormEntity(submitParameters));
CloseableHttpClient httpclient = HttpClients.createDefault();
context = HttpClientContext.create();
submitResponse = httpclient.execute(httpPost, FormAPIConnection.bodyResponseHandler(), context);
httpclient.close();
} catch (IOException e) {
e.printStackTrace();
}
// test that response is from success url
assertNotNull(submitResponse);
assertTrue(submitResponse.contains("paymenthighway"));
List<URI> redirectURIs = context.getRedirectLocations();
assertEquals(2, redirectURIs.size());
String query = redirectURIs.get(1).getQuery();
assertThat(query, StringStartsWith.startsWith("success"));
return query;
}
ExpectedException.java 文件源码
项目:assertj-core
阅读 23
收藏 0
点赞 0
评论 0
private void expectMessageStartingWith(String start) {
delegate.expectMessage(StringStartsWith.startsWith(format(start)));
}