本文整理匯總了Java中org.hamcrest.core.IsNot類的典型用法代碼示例。如果您正苦於以下問題:Java IsNot類的具體用法?Java IsNot怎麽用?Java IsNot使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
IsNot類屬於org.hamcrest.core包,在下文中一共展示了IsNot類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testEncodeResourceRef
import org.hamcrest.core.IsNot; //導入依賴的package包/類
@Test
public void testEncodeResourceRef() throws DataFormatException {
Patient patient = new Patient();
patient.setManagingOrganization(new ResourceReferenceDt());
IParser p = ourCtx.newXmlParser();
String str = p.encodeResourceToString(patient);
assertThat(str, IsNot.not(StringContains.containsString("managingOrganization")));
ResourceReferenceDt ref = new ResourceReferenceDt();
ref.setReference("Organization/123");
ref.setDisplay("DISPLAY!");
patient.setManagingOrganization(ref);
str = p.encodeResourceToString(patient);
assertThat(str, StringContains.containsString("<managingOrganization><reference value=\"Organization/123\"/><display value=\"DISPLAY!\"/></managingOrganization>"));
Organization org = new Organization();
org.addIdentifier().setSystem("foo").setValue("bar");
patient.setManagingOrganization(new ResourceReferenceDt(org));
str = p.encodeResourceToString(patient);
assertThat(str, StringContains.containsString("<contained><Organization"));
}
示例2: testEncodeContainedResourcesMore
import org.hamcrest.core.IsNot; //導入依賴的package包/類
@Test
public void testEncodeContainedResourcesMore() {
DiagnosticReport rpt = new DiagnosticReport();
Specimen spm = new Specimen();
rpt.getText().setDiv("AAA");
rpt.addSpecimen().setResource(spm);
IParser p = new FhirContext(DiagnosticReport.class).newJsonParser().setPrettyPrint(true);
String str = p.encodeResourceToString(rpt);
ourLog.info(str);
assertThat(str, StringContains.containsString("<div>AAA</div>"));
String substring = "\"reference\":\"#";
assertThat(str, StringContains.containsString(substring));
int idx = str.indexOf(substring) + substring.length();
int idx2 = str.indexOf('"', idx + 1);
String id = str.substring(idx, idx2);
assertThat(str, StringContains.containsString("\"id\":\"" + id + "\""));
assertThat(str, IsNot.not(StringContains.containsString("<?xml version='1.0'?>")));
}
示例3: testEncodeResourceRef
import org.hamcrest.core.IsNot; //導入依賴的package包/類
@Test
public void testEncodeResourceRef() throws DataFormatException {
Patient patient = new Patient();
patient.setManagingOrganization(new ResourceReferenceDt());
IParser p = new FhirContext().newJsonParser();
String str = p.encodeResourceToString(patient);
assertThat(str, IsNot.not(StringContains.containsString("managingOrganization")));
patient.setManagingOrganization(new ResourceReferenceDt("Organization/123"));
str = p.encodeResourceToString(patient);
assertThat(str, StringContains.containsString("\"managingOrganization\":{\"reference\":\"Organization/123\"}"));
Organization org = new Organization();
org.addIdentifier().setSystem("foo").setValue("bar");
patient.setManagingOrganization(new ResourceReferenceDt(org));
str = p.encodeResourceToString(patient);
assertThat(str, StringContains.containsString("\"contained\":[{\"resourceType\":\"Organization\""));
}
示例4: testEncodeContainedResources
import org.hamcrest.core.IsNot; //導入依賴的package包/類
@Test
public void testEncodeContainedResources() throws Exception {
DiagnosticReport rpt = new DiagnosticReport();
Specimen spm = new Specimen();
spm.addIdentifier().setSystem("urn").setValue( "123");
rpt.getText().setDivAsString("AAA");
rpt.addSpecimen().setResource(spm);
IParser p = ourCtx.newXmlParser().setPrettyPrint(true);
String str = p.encodeResourceToString(rpt);
ourLog.info(str);
assertThat(str, StringContains.containsString("<div xmlns=\"http://www.w3.org/1999/xhtml\">AAA</div>"));
assertThat(str, StringContains.containsString("reference value=\"#"));
int idx = str.indexOf("reference value=\"#") + "reference value=\"#".length();
int idx2 = str.indexOf('"', idx + 1);
String id = str.substring(idx, idx2);
assertThat(str, StringContains.containsString("<Specimen xmlns=\"http://hl7.org/fhir\" id=\"" + id + "\">"));
assertThat(str, IsNot.not(StringContains.containsString("<?xml version='1.0'?>")));
}
示例5: testEncodeResourceRef
import org.hamcrest.core.IsNot; //導入依賴的package包/類
@Test
public void testEncodeResourceRef() throws DataFormatException {
Patient patient = new Patient();
patient.setManagingOrganization(new Reference());
IParser p = ourCtx.newXmlParser();
String str = p.encodeResourceToString(patient);
assertThat(str, IsNot.not(StringContains.containsString("managingOrganization")));
Reference ref = new Reference();
ref.setReference("Organization/123");
ref.setDisplay("DISPLAY!");
patient.setManagingOrganization(ref);
str = p.encodeResourceToString(patient);
assertThat(str, StringContains.containsString("<managingOrganization><reference value=\"Organization/123\"/><display value=\"DISPLAY!\"/></managingOrganization>"));
Organization org = new Organization();
org.addIdentifier().setSystem("foo").setValue("bar");
patient.setManagingOrganization(new Reference(org));
str = p.encodeResourceToString(patient);
assertThat(str, StringContains.containsString("<contained><Organization"));
}
示例6: testEncodeContainedResourcesMore
import org.hamcrest.core.IsNot; //導入依賴的package包/類
@Test
public void testEncodeContainedResourcesMore() throws Exception {
DiagnosticReport rpt = new DiagnosticReport();
Specimen spm = new Specimen();
rpt.getText().setDivAsString("AAA");
rpt.addSpecimen().setResource(spm);
IParser p = new FhirContext(DiagnosticReport.class).newJsonParser().setPrettyPrint(true);
String str = p.encodeResourceToString(rpt);
ourLog.info(str);
assertThat(str, StringContains.containsString("<div>AAA</div>"));
String substring = "\"reference\":\"#";
assertThat(str, StringContains.containsString(substring));
int idx = str.indexOf(substring) + substring.length();
int idx2 = str.indexOf('"', idx + 1);
String id = str.substring(idx, idx2);
assertThat(str, StringContains.containsString("\"id\":\"" + id + "\""));
assertThat(str, IsNot.not(StringContains.containsString("<?xml version='1.0'?>")));
}
示例7: testEncodeResourceRef
import org.hamcrest.core.IsNot; //導入依賴的package包/類
@Test
public void testEncodeResourceRef() throws DataFormatException {
Patient patient = new Patient();
patient.setManagingOrganization(new Reference());
IParser p = new FhirContext().newJsonParser();
String str = p.encodeResourceToString(patient);
assertThat(str, IsNot.not(StringContains.containsString("managingOrganization")));
patient.setManagingOrganization(new Reference("Organization/123"));
str = p.encodeResourceToString(patient);
assertThat(str, StringContains.containsString("\"managingOrganization\":{\"reference\":\"Organization/123\"}"));
Organization org = new Organization();
org.addIdentifier().setSystem("foo").setValue("bar");
patient.setManagingOrganization(new Reference(org));
str = p.encodeResourceToString(patient);
assertThat(str, StringContains.containsString("\"contained\":[{\"resourceType\":\"Organization\""));
}
示例8: testEncodeContainedResourcesMore
import org.hamcrest.core.IsNot; //導入依賴的package包/類
@Test
public void testEncodeContainedResourcesMore() {
DiagnosticReport rpt = new DiagnosticReport();
Specimen spm = new Specimen();
rpt.getText().setDiv("AAA");
rpt.addSpecimen().setResource(spm);
IParser p = new FhirContext(DiagnosticReport.class).newJsonParser().setPrettyPrint(true);
String str = p.encodeResourceToString(rpt);
ourLog.info(str);
assertThat(str, StringContains.containsString("<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">AAA</div>"));
String substring = "\"reference\": \"#";
assertThat(str, StringContains.containsString(substring));
int idx = str.indexOf(substring) + substring.length();
int idx2 = str.indexOf('"', idx + 1);
String id = str.substring(idx, idx2);
assertThat(str, StringContains.containsString("\"id\": \"" + id + "\""));
assertThat(str, IsNot.not(StringContains.containsString("<?xml version='1.0'?>")));
}
示例9: testEncodeResourceRef
import org.hamcrest.core.IsNot; //導入依賴的package包/類
@Test
public void testEncodeResourceRef() throws DataFormatException {
Patient patient = new Patient();
patient.setManagingOrganization(new ResourceReferenceDt());
IParser p = ourCtx.newJsonParser();
String str = p.encodeResourceToString(patient);
assertThat(str, IsNot.not(StringContains.containsString("managingOrganization")));
patient.setManagingOrganization(new ResourceReferenceDt("Organization/123"));
str = p.encodeResourceToString(patient);
assertThat(str, StringContains.containsString("\"managingOrganization\":{\"reference\":\"Organization/123\"}"));
Organization org = new Organization();
org.addIdentifier().setSystem("foo").setValue("bar");
patient.setManagingOrganization(new ResourceReferenceDt(org));
str = p.encodeResourceToString(patient);
assertThat(str, StringContains.containsString("\"contained\":[{\"resourceType\":\"Organization\""));
}
示例10: testEncodeContainedResources
import org.hamcrest.core.IsNot; //導入依賴的package包/類
@Test
public void testEncodeContainedResources() throws Exception {
DiagnosticReport rpt = new DiagnosticReport();
Specimen spm = new Specimen();
spm.addIdentifier().setSystem("urn").setValue("123");
rpt.getText().setDivAsString("AAA");
rpt.addSpecimen().setResource(spm);
IParser p = ourCtx.newXmlParser().setPrettyPrint(true);
String str = p.encodeResourceToString(rpt);
ourLog.info(str);
assertThat(str, StringContains.containsString("<div xmlns=\"http://www.w3.org/1999/xhtml\">AAA</div>"));
assertThat(str, StringContains.containsString("reference value=\"#"));
int idx = str.indexOf("reference value=\"#") + "reference value=\"#".length();
int idx2 = str.indexOf('"', idx + 1);
String id = str.substring(idx, idx2);
assertThat(str, stringContainsInOrder("<Specimen xmlns=\"http://hl7.org/fhir\">", "<id value=\"" + id + "\"/>"));
assertThat(str, IsNot.not(StringContains.containsString("<?xml version='1.0'?>")));
}
示例11: testEncodeResourceRef
import org.hamcrest.core.IsNot; //導入依賴的package包/類
@Test
public void testEncodeResourceRef() throws DataFormatException {
Patient patient = new Patient();
patient.setManagingOrganization(new Reference());
IParser p = ourCtx.newXmlParser();
String str = p.encodeResourceToString(patient);
assertThat(str, IsNot.not(StringContains.containsString("managingOrganization")));
Reference ref = new Reference();
ref.setReference("Organization/123");
ref.setDisplay("DISPLAY!");
patient.setManagingOrganization(ref);
str = p.encodeResourceToString(patient);
assertThat(str, StringContains.containsString(
"<managingOrganization><reference value=\"Organization/123\"/><display value=\"DISPLAY!\"/></managingOrganization>"));
Organization org = new Organization();
org.addIdentifier().setSystem("foo").setValue("bar");
patient.setManagingOrganization(new Reference(org));
str = p.encodeResourceToString(patient);
assertThat(str, StringContains.containsString("<contained><Organization"));
}
示例12: testEncodeContainedResourcesMore
import org.hamcrest.core.IsNot; //導入依賴的package包/類
@Test
public void testEncodeContainedResourcesMore() throws Exception {
DiagnosticReport rpt = new DiagnosticReport();
Specimen spm = new Specimen();
rpt.getText().setDivAsString("AAA");
rpt.addSpecimen().setResource(spm);
IParser p = ourCtx.newJsonParser().setPrettyPrint(true);
String str = p.encodeResourceToString(rpt);
ourLog.info(str);
assertThat(str, StringContains.containsString("<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">AAA</div>"));
String substring = "\"reference\": \"#";
assertThat(str, StringContains.containsString(substring));
int idx = str.indexOf(substring) + substring.length();
int idx2 = str.indexOf('"', idx + 1);
String id = str.substring(idx, idx2);
assertThat(str, StringContains.containsString("\"id\": \"" + id + "\""));
assertThat(str, IsNot.not(StringContains.containsString("<?xml version='1.0'?>")));
}
示例13: testEncodeResourceRef
import org.hamcrest.core.IsNot; //導入依賴的package包/類
@Test
public void testEncodeResourceRef() throws DataFormatException {
Patient patient = new Patient();
patient.setManagingOrganization(new Reference());
IParser p = ourCtx.newJsonParser();
String str = p.encodeResourceToString(patient);
assertThat(str, IsNot.not(StringContains.containsString("managingOrganization")));
patient.setManagingOrganization(new Reference("Organization/123"));
str = p.encodeResourceToString(patient);
assertThat(str, StringContains.containsString("\"managingOrganization\":{\"reference\":\"Organization/123\"}"));
Organization org = new Organization();
org.addIdentifier().setSystem("foo").setValue("bar");
patient.setManagingOrganization(new Reference(org));
str = p.encodeResourceToString(patient);
assertThat(str, StringContains.containsString("\"contained\":[{\"resourceType\":\"Organization\""));
}
示例14: testWriteExtraCustomSoapHeadersToXmlWithPartnertoken
import org.hamcrest.core.IsNot; //導入依賴的package包/類
/**
* Test if content is added correctly if expectPartnerToken is set.
*
* @throws ServiceValidationException
* @throws XMLStreamException the XML stream exception
* @throws ServiceXmlSerializationException the service xml serialization exception
*/
@Test
public void testWriteExtraCustomSoapHeadersToXmlWithPartnertoken()
throws ServiceValidationException, XMLStreamException, ServiceXmlSerializationException {
GetUserSettingsRequest getUserSettingsRequest =
new GetUserSettingsRequest(autodiscoverService, uriMockHttps, Boolean.TRUE);
// Test without expected Partnertoken
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
getUserSettingsRequest.writeExtraCustomSoapHeadersToXml(
new EwsServiceXmlWriter(exchangeServiceBaseMock, byteArrayOutputStream));
// data should be added the same way as mentioned
Assert.assertThat(byteArrayOutputStream.toByteArray(),
IsNot.not(new ByteArrayOutputStream().toByteArray()));
//TODO Test if the output is really correct
}
示例15: testDontChangeValueOnException
import org.hamcrest.core.IsNot; //導入依賴的package包/類
/**
* Test for checking if the value changes in case of a thrown exception
*
* @throws Exception
*/
@Test
public void testDontChangeValueOnException() throws Exception {
// set valid value
final Double targetValue = 50.5;
taskMock.setPercentComplete(targetValue);
assertThat(taskMock.getPercentComplete(), IsNot.not(IsNull.nullValue()));
assertThat(taskMock.getPercentComplete(), IsInstanceOf.instanceOf(Double.class));
assertThat(taskMock.getPercentComplete(), IsEqual.equalTo(targetValue));
final Double invalidValue = -0.1;
try {
taskMock.setPercentComplete(invalidValue);
} catch (IllegalArgumentException ex) {
// ignored
}
assertThat(taskMock.getPercentComplete(), IsNot.not(IsNull.nullValue()));
assertThat(taskMock.getPercentComplete(), IsInstanceOf.instanceOf(Double.class));
assertThat(taskMock.getPercentComplete(), IsEqual.equalTo(targetValue));
}