本文整理汇总了Java中org.hamcrest.core.StringEndsWith类的典型用法代码示例。如果您正苦于以下问题:Java StringEndsWith类的具体用法?Java StringEndsWith怎么用?Java StringEndsWith使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringEndsWith类属于org.hamcrest.core包,在下文中一共展示了StringEndsWith类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testUpdate
import org.hamcrest.core.StringEndsWith; //导入依赖的package包/类
@Test
public void testUpdate() throws Exception {
Patient patient = new Patient();
patient.addIdentifier("urn:foo", "123");
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_TEXT + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")));
when(httpResponse.getAllHeaders()).thenReturn(toHeaderArray("Location", "http://example.com/fhir/Patient/100/_history/200"));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
MethodOutcome response = client.updatePatient(new IdDt("100"), patient);
assertEquals(HttpPut.class, capt.getValue().getClass());
HttpPut post = (HttpPut) capt.getValue();
assertThat(post.getURI().toASCIIString(), StringEndsWith.endsWith("/Patient/100"));
assertThat(IOUtils.toString(post.getEntity().getContent()), StringContains.containsString("<Patient"));
assertEquals("http://example.com/fhir/Patient/100/_history/200", response.getId().getValue());
assertEquals("200", response.getId().getVersionIdPart());
assertEquals(EncodingEnum.XML.getResourceContentType() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(0).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue());
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:25,代码来源:ClientTest.java
示例2: testUpdateWithVersion
import org.hamcrest.core.StringEndsWith; //导入依赖的package包/类
@Test
public void testUpdateWithVersion() throws Exception {
Patient patient = new Patient();
patient.addIdentifier("urn:foo", "123");
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_TEXT + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")));
when(httpResponse.getAllHeaders()).thenReturn(toHeaderArray("Location", "http://example.com/fhir/Patient/100/_history/200"));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
MethodOutcome response = client.updatePatient(new IdDt("Patient/100/_history/200"), patient);
assertEquals(HttpPut.class, capt.getValue().getClass());
HttpPut post = (HttpPut) capt.getValue();
assertThat(post.getURI().toASCIIString(), StringEndsWith.endsWith("/Patient/100"));
assertThat(IOUtils.toString(post.getEntity().getContent()), StringContains.containsString("<Patient"));
assertThat(post.getFirstHeader("Content-Location").getValue(), StringEndsWith.endsWith("Patient/100/_history/200"));
assertEquals("http://example.com/fhir/Patient/100/_history/200", response.getId().getValue());
assertEquals("200", response.getId().getVersionIdPart());
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:25,代码来源:ClientTest.java
示例3: testValidate
import org.hamcrest.core.StringEndsWith; //导入依赖的package包/类
@Test
public void testValidate() throws Exception {
Patient patient = new Patient();
patient.addIdentifier("urn:foo", "123");
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_TEXT + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")));
when(httpResponse.getAllHeaders()).thenReturn(toHeaderArray("Location", "http://example.com/fhir/Patient/100/_history/200"));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
MethodOutcome response = client.validatePatient(patient);
assertEquals(HttpPost.class, capt.getValue().getClass());
HttpPost post = (HttpPost) capt.getValue();
assertThat(post.getURI().toASCIIString(), StringEndsWith.endsWith("/Patient/_validate"));
assertThat(IOUtils.toString(post.getEntity().getContent()), StringContains.containsString("<Patient"));
assertEquals("http://example.com/fhir/Patient/100/_history/200", response.getId().getValue());
assertEquals("200", response.getId().getVersionIdPart());
}
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:25,代码来源:ClientTest.java
示例4: testUpdate
import org.hamcrest.core.StringEndsWith; //导入依赖的package包/类
@Test
public void testUpdate() throws Exception {
Patient patient = new Patient();
patient.addIdentifier().setSystem("urn:foo").setValue("123");
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK"));
when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_TEXT + "; charset=UTF-8"));
when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")));
when(myHttpResponse.getAllHeaders()).thenReturn(toHeaderArray("Location", "http://example.com/fhir/Patient/100/_history/200"));
ITestClient client = ourCtx.newRestfulClient(ITestClient.class, "http://foo");
MethodOutcome response = client.updatePatient(new IdType("100"), patient);
assertEquals(HttpPut.class, capt.getValue().getClass());
HttpPut post = (HttpPut) capt.getValue();
assertThat(post.getURI().toASCIIString(), StringEndsWith.endsWith("/Patient/100"));
assertThat(IOUtils.toString(post.getEntity().getContent(), Charsets.UTF_8), StringContains.containsString("<Patient"));
assertEquals("http://example.com/fhir/Patient/100/_history/200", response.getId().getValue());
assertEquals("200", response.getId().getVersionIdPart());
assertEquals(EncodingEnum.XML.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(0).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue());
}
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:25,代码来源:ClientR4Test.java
示例5: testUpdateWithVersion
import org.hamcrest.core.StringEndsWith; //导入依赖的package包/类
@Test
public void testUpdateWithVersion() throws Exception {
Patient patient = new Patient();
patient.addIdentifier().setSystem("urn:foo").setValue("123");
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK"));
when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_TEXT + "; charset=UTF-8"));
when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")));
when(myHttpResponse.getAllHeaders()).thenReturn(toHeaderArray("Location", "http://example.com/fhir/Patient/100/_history/200"));
ITestClient client = ourCtx.newRestfulClient(ITestClient.class, "http://foo");
MethodOutcome response = client.updatePatient(new IdType("Patient/100/_history/200"), patient);
assertEquals(HttpPut.class, capt.getValue().getClass());
HttpPut post = (HttpPut) capt.getValue();
assertThat(post.getURI().toASCIIString(), StringEndsWith.endsWith("/Patient/100"));
assertThat(IOUtils.toString(post.getEntity().getContent(), Charsets.UTF_8), StringContains.containsString("<Patient"));
assertEquals("http://example.com/fhir/Patient/100/_history/200", response.getId().getValue());
assertEquals("200", response.getId().getVersionIdPart());
}
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:24,代码来源:ClientR4Test.java
示例6: testValidateNoContentResponse
import org.hamcrest.core.StringEndsWith; //导入依赖的package包/类
@Test
public void testValidateNoContentResponse() throws Exception {
Patient patient = new Patient();
patient.addIdentifier().setSystem("urn:foo").setValue("123");
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), Constants.STATUS_HTTP_204_NO_CONTENT, "OK"));
when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_TEXT + "; charset=UTF-8"));
when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")));
when(myHttpResponse.getAllHeaders()).thenReturn(toHeaderArray("Location", "http://example.com/fhir/Patient/100/_history/200"));
ITestClient client = ourCtx.newRestfulClient(ITestClient.class, "http://foo");
MethodOutcome response = client.validatePatient(patient);
assertEquals(HttpPost.class, capt.getValue().getClass());
HttpPost post = (HttpPost) capt.getValue();
assertThat(post.getURI().toASCIIString(), StringEndsWith.endsWith("/Patient/$validate"));
assertThat(IOUtils.toString(post.getEntity().getContent(), Charsets.UTF_8), StringContains.containsString("<Patient"));
assertNull(response.getOperationOutcome());
assertNull(response.getResource());
}
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:24,代码来源:ClientR4Test.java
示例7: getClassesInPackage
import org.hamcrest.core.StringEndsWith; //导入依赖的package包/类
private static Collection<String> getClassesInPackage(String packageName, String sampleClass) {
String sampleClassPathSuffix = sampleClass.replaceAll("\\.", "/") + ".class";
String sampleClassPath = CheckParserUsagesDT.class.getClassLoader().getResource(sampleClassPathSuffix).getPath();
assertThat(sampleClassPath, new StringEndsWith(sampleClassPathSuffix));
String packagePath = sampleClassPath.substring(0,sampleClassPath.length()-sampleClassPathSuffix.length()) +
packageName.replaceAll("\\.", "/");
return getAllClassesInDirectory(new File(packagePath));
}
开发者ID:jaytaylor,项目名称:sql-layer,代码行数:9,代码来源:CheckParserUsagesDT.java
示例8: call_a_method_that_is_not_implemented
import org.hamcrest.core.StringEndsWith; //导入依赖的package包/类
@Test public void call_a_method_that_is_not_implemented() {
// GIVEN
// THEN
this.expectedException.expect(FakeJedisNotImplementedException.class);
this.expectedException.expectMessage(StringStartsWith.startsWith("The method "));
this.expectedException.expectMessage(StringContains.containsString("FakeJedis.mget"));
this.expectedException.expectMessage(StringEndsWith.endsWith(" is not implemented in your version of FakeJedis. Contribute on github! https://github.com/vdurmont/fake-jedis"));
// WHEN
this.jedis.mget(KEY);
}
开发者ID:vdurmont,项目名称:fake-jedis,代码行数:13,代码来源:FakeJedisTest.java
示例9: testValidateOutcomeResponse
import org.hamcrest.core.StringEndsWith; //导入依赖的package包/类
@Test
public void testValidateOutcomeResponse() throws Exception {
OperationOutcome oo = new OperationOutcome();
oo.addIssue().setDiagnostics("ALL GOOD");
String resp = ourCtx.newJsonParser().encodeResourceToString(oo);
Patient patient = new Patient();
patient.addIdentifier().setSystem("urn:foo").setValue("123");
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_JSON_NEW + "; charset=UTF-8"));
when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(resp), Charset.forName("UTF-8")));
when(myHttpResponse.getAllHeaders()).thenReturn(toHeaderArray("Location", "http://example.com/fhir/Patient/100/_history/200"));
ITestClient client = ourCtx.newRestfulClient(ITestClient.class, "http://foo");
MethodOutcome response = client.validatePatient(patient);
assertEquals(HttpPost.class, capt.getValue().getClass());
HttpPost post = (HttpPost) capt.getValue();
assertThat(post.getURI().toASCIIString(), StringEndsWith.endsWith("/Patient/$validate"));
assertThat(IOUtils.toString(post.getEntity().getContent(), Charsets.UTF_8), StringContains.containsString("<Patient"));
assertNotNull(response.getOperationOutcome());
assertEquals("ALL GOOD", ((OperationOutcome)response.getOperationOutcome()).getIssueFirstRep().getDiagnostics());
assertNull(response.getResource());
}
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:29,代码来源:ClientR4Test.java
示例10: expectMessageEndingWith
import org.hamcrest.core.StringEndsWith; //导入依赖的package包/类
private void expectMessageEndingWith(String end) {
delegate.expectMessage(StringEndsWith.endsWith(format(end)));
}
开发者ID:assertj,项目名称:assertj-vavr,代码行数:4,代码来源:ExpectedException.java
示例11: toString_
import org.hamcrest.core.StringEndsWith; //导入依赖的package包/类
@Test
public void toString_() {
assertThat(this.connection.toString(), new StringStartsWith(Connection.class.getName() + "@"));
assertThat(this.connection.toString(), new StringEndsWith("[sessionId=ABC123]"));
}
开发者ID:dansiviter,项目名称:cito,代码行数:6,代码来源:ConnectionTest.java
示例12: toString_
import org.hamcrest.core.StringEndsWith; //导入依赖的package包/类
@Test
public void toString_() {
assertThat(this.session.toString(), new StringStartsWith(Session.class.getName() + "@"));
assertThat(this.session.toString(), new StringEndsWith("[connection=conn,session=delegate]"));
}
开发者ID:dansiviter,项目名称:cito,代码行数:6,代码来源:SessionTest.java
示例13: testLoader
import org.hamcrest.core.StringEndsWith; //导入依赖的package包/类
@Test
public void testLoader() throws IOException, InterruptedException
{
List<String> fileNames = _createFileNames();
_createTestFiles(dir, fileNames);
File mainJnlp = _createJnlps(dir, fileNames);
Path store1Path = dir.toPath().resolve("store1");
Path store2Path = dir.toPath().resolve("store2");
IResourcePack remoteResourcePack = ResourcePackFactory.get(mainJnlp.toURI().toURL());
IStore localStore = new LocalStore(store1Path);
Thread.sleep(1000);
IStoreResourcePack localResourcePack = new Loader().load(localStore, remoteResourcePack, null);
_check(remoteResourcePack, localResourcePack);
Path localResourcePackPath = store1Path.resolve(localResourcePack.getId() + ".jlr.xml");
remoteResourcePack = ResourcePackFactory.get(localResourcePackPath.toUri().toURL());
localStore = new LocalStore(store2Path);
Thread.sleep(1000);
localResourcePack = new Loader().load(localStore, remoteResourcePack, null);
_check(remoteResourcePack, localResourcePack);
JLoaderConfig loaderConfig = new JLoaderConfig();
IStoreResource configResource = localResourcePack.getResource(JLoaderConfig.CONFIG_ID);
Assert.assertNotNull(configResource);
try (InputStream inputStream = configResource.getInputStream())
{
loaderConfig.load(inputStream);
}
Path workingDirectory = store2Path.resolve(localResourcePack.getId()).toAbsolutePath();
Process process = new ProcessBuilder(loaderConfig.getStartCommands(workingDirectory, null))
.directory(workingDirectory.toFile())
.start();
process.waitFor(10, TimeUnit.SECONDS);
Assert.assertEquals(0, process.exitValue());
String sout = _readString(process.getInputStream());
String serr = _readString(process.getErrorStream());
Assert.assertEquals("arg1\ntrue\n", sout);
Assert.assertThat(serr, StringEndsWith.endsWith("arg2\n"));
}
开发者ID:aditosoftware,项目名称:jloadr,代码行数:46,代码来源:Test_Loader.java
示例14: expectMessageEndingWith
import org.hamcrest.core.StringEndsWith; //导入依赖的package包/类
private void expectMessageEndingWith(String end) {
delegate.expectMessage(StringEndsWith.endsWith(format(end)));
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:4,代码来源:ExpectedException.java
注:本文中的org.hamcrest.core.StringEndsWith类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论