java类org.hamcrest.core.IsNot的实例源码

XmlParserTest.java 文件源码 项目:FHIR-Server 阅读 18 收藏 0 点赞 0 评论 0
@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"));

}
JsonParserTest.java 文件源码 项目:FHIR-Server 阅读 30 收藏 0 点赞 0 评论 0
@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'?>")));

}
JsonParserTest.java 文件源码 项目:FHIR-Server 阅读 25 收藏 0 点赞 0 评论 0
@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\""));

}
XmlParserTest.java 文件源码 项目:FHIR-Server 阅读 23 收藏 0 点赞 0 评论 0
@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'?>")));

}
XmlParserTest.java 文件源码 项目:FHIR-Server 阅读 18 收藏 0 点赞 0 评论 0
@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"));

}
JsonParserTest.java 文件源码 项目:FHIR-Server 阅读 29 收藏 0 点赞 0 评论 0
@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'?>")));

}
JsonParserTest.java 文件源码 项目:FHIR-Server 阅读 22 收藏 0 点赞 0 评论 0
@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\""));

}
XmlParserTest.java 文件源码 项目:hapi-fhir 阅读 20 收藏 0 点赞 0 评论 0
@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"));

}
JsonParserTest.java 文件源码 项目:hapi-fhir 阅读 26 收藏 0 点赞 0 评论 0
@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'?>")));

}
JsonParserTest.java 文件源码 项目:hapi-fhir 阅读 26 收藏 0 点赞 0 评论 0
@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\""));

}
XmlParserHl7OrgDstu2Test.java 文件源码 项目:hapi-fhir 阅读 17 收藏 0 点赞 0 评论 0
@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'?>")));

}
XmlParserHl7OrgDstu2Test.java 文件源码 项目:hapi-fhir 阅读 20 收藏 0 点赞 0 评论 0
@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"));

}
JsonParserHl7OrgDstu2Test.java 文件源码 项目:hapi-fhir 阅读 21 收藏 0 点赞 0 评论 0
@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'?>")));

}
JsonParserHl7OrgDstu2Test.java 文件源码 项目:hapi-fhir 阅读 22 收藏 0 点赞 0 评论 0
@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\""));

}
GetUserSettingsRequestTest.java 文件源码 项目:ews-java-api 阅读 20 收藏 0 点赞 0 评论 0
/**
 * 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
}
TaskTest.java 文件源码 项目:ews-java-api 阅读 30 收藏 0 点赞 0 评论 0
/**
 * 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));
}
ITestSolrRepositoryOperations.java 文件源码 项目:spring-data-solr 阅读 21 收藏 0 点赞 0 评论 0
@Test
public void testQueryWithHighlight() {
    HighlightPage<ProductBean> page = repo.findByNameHighlightAll("na", new PageRequest(0, 10));
    Assert.assertEquals(3, page.getNumberOfElements());

    for (ProductBean product : page) {
        List<Highlight> highlights = page.getHighlights(product);
        Assert.assertThat(highlights, IsNot.not(IsEmptyCollection.empty()));
        for (Highlight highlight : highlights) {
            Assert.assertEquals("name", highlight.getField().getName());
            Assert.assertThat(highlight.getSnipplets(), IsNot.not(IsEmptyCollection.empty()));
            for (String s : highlight.getSnipplets()) {
                Assert.assertTrue("expected to find <em>name</em> but was \"" + s + "\"", s.contains("<em>name</em>"));
            }
        }
    }
}
ITestSolrRepositoryOperations.java 文件源码 项目:spring-data-solr 阅读 22 收藏 0 点赞 0 评论 0
@Test
public void testHighlightWithPrefixPostfix() {
    HighlightPage<ProductBean> page = repo.findByNameHighlightAllWithPreAndPostfix("na", new PageRequest(0, 10));
    Assert.assertEquals(3, page.getNumberOfElements());

    for (ProductBean product : page) {
        List<Highlight> highlights = page.getHighlights(product);
        Assert.assertThat(highlights, IsNot.not(IsEmptyCollection.empty()));
        for (Highlight highlight : highlights) {
            Assert.assertEquals("name", highlight.getField().getName());
            Assert.assertThat(highlight.getSnipplets(), IsNot.not(IsEmptyCollection.empty()));
            for (String s : highlight.getSnipplets()) {
                Assert.assertTrue("expected to find <b>name</b> but was \"" + s + "\"", s.contains("<b>name</b>"));
            }
        }
    }
}
ITestSolrRepositoryOperations.java 文件源码 项目:spring-data-solr 阅读 20 收藏 0 点赞 0 评论 0
@Test
public void testHighlightWithFields() {
    ProductBean beanWithText = createProductBean("withName", 5, true);
    beanWithText.setDescription("some text with name in it");
    repo.save(beanWithText);

    HighlightPage<ProductBean> page = repo.findByNameHighlightAllLimitToFields("na", new PageRequest(0, 10));
    Assert.assertEquals(4, page.getNumberOfElements());

    for (ProductBean product : page) {
        List<Highlight> highlights = page.getHighlights(product);
        if (!product.getId().equals(beanWithText.getId())) {
            Assert.assertThat(highlights, IsEmptyCollection.empty());
        } else {
            Assert.assertThat(highlights, IsNot.not(IsEmptyCollection.empty()));
            for (Highlight highlight : highlights) {
                Assert.assertEquals("description", highlight.getField().getName());
                Assert.assertThat(highlight.getSnipplets(), IsNot.not(IsEmptyCollection.empty()));
                for (String s : highlight.getSnipplets()) {
                    Assert.assertTrue("expected to find <em>name</em> but was \"" + s + "\"", s.contains("<em>name</em>"));
                }
            }
        }
    }
}
BuildCauseProducerServiceConfigRepoIntegrationTest.java 文件源码 项目:gocd 阅读 20 收藏 0 点赞 0 评论 0
@Test
public void shouldNotScheduleWhenPipelineRemovedFromConfigRepoWhenManuallyTriggered() throws Exception
{
    configTestRepo.addCodeToRepositoryAndPush(fileName, "removed pipeline from configuration",
            "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
            + "<cruise xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"cruise-config.xsd\" schemaVersion=\"38\">\n"
            + "</cruise>");

    final HashMap<String, String> revisions = new HashMap<>();
    final HashMap<String, String> environmentVariables = new HashMap<>();
    buildCauseProducer.manualProduceBuildCauseAndSave(PIPELINE_NAME, Username.ANONYMOUS,
            new ScheduleOptions(revisions, environmentVariables, new HashMap<>()), new ServerHealthStateOperationResult());
    waitForMaterialNotInProgress();
    // config is correct
    cachedGoConfig.throwExceptionIfExists();
    assertThat(pipelineScheduleQueue.toBeScheduled().keySet(), IsNot.not(hasItem(PIPELINE_NAME)));
    assertThat(goConfigService.hasPipelineNamed(pipelineConfig.name()),is(false));
}
SafeDeleteTest.java 文件源码 项目:toffi 阅读 22 收藏 0 点赞 0 评论 0
@Test
public void testSafeFileDeleteFile() throws Exception {
    UUID uuid = UUID.randomUUID();
    Path fileUnderTest = Paths.get(ROOT_DIR, uuid.toString());
    FileUtils.touch(fileUnderTest.toString(), 10 * FILE_SIZE_FACTOR);

    byte[] sha1SumBefore;
    try (FileInputStream fileInputStream = new FileInputStream(fileUnderTest.toFile())) {
        sha1SumBefore = DigestUtils.sha1(fileInputStream);
    }
    long fileLengthBefore = fileUnderTest.toFile().length();

    RandomBytesNoiseGenerator noiseGenerator = new RandomBytesNoiseGenerator();
    SafeDelete safeDelete = new SafeDelete(noiseGenerator);
    safeDelete.generateNoise(fileUnderTest);

    byte[] sha1SumAfter;
    try (FileInputStream fileInputStream = new FileInputStream(fileUnderTest.toFile())) {
        sha1SumAfter = DigestUtils.sha1(fileInputStream);
    }
    long fileLengthAfter = fileUnderTest.toFile().length();

    Assert.assertThat(sha1SumBefore, IsNot.not(IsEqual.equalTo(sha1SumAfter)));
    Assert.assertEquals(fileLengthBefore, fileLengthAfter);
}
SafeDeleteTest.java 文件源码 项目:toffi 阅读 21 收藏 0 点赞 0 评论 0
@Test
public void testSafeFileDeleteSmallFile() throws Exception {
    UUID uuid = UUID.randomUUID();
    Path fileUnderTest = Paths.get(ROOT_DIR, uuid.toString());
    FileUtils.touch(fileUnderTest.toString(), 10);

    byte[] sha1SumBefore;
    try (FileInputStream fileInputStream = new FileInputStream(fileUnderTest.toFile())) {
        sha1SumBefore = DigestUtils.sha1(fileInputStream);
    }
    long fileLengthBefore = fileUnderTest.toFile().length();

    RandomBytesNoiseGenerator noiseGenerator = new RandomBytesNoiseGenerator();
    SafeDelete safeDelete = new SafeDelete(noiseGenerator);
    safeDelete.generateNoise(fileUnderTest);

    byte[] sha1SumAfter;
    try (FileInputStream fileInputStream = new FileInputStream(fileUnderTest.toFile())) {
        sha1SumAfter = DigestUtils.sha1(fileInputStream);
    }
    long fileLengthAfter = fileUnderTest.toFile().length();

    Assert.assertThat(sha1SumBefore, IsNot.not(IsEqual.equalTo(sha1SumAfter)));
    Assert.assertEquals(fileLengthBefore, fileLengthAfter);
}
PagerAdaptersLoggingTest.java 文件源码 项目:android_pager_adapters 阅读 18 收藏 0 点赞 0 评论 0
@Test
public void testSetLogger() {
    PagerAdaptersLogging.setLogger(null);
    assertThat(PagerAdaptersLogging.getLogger(), is(IsNot.not(IsNull.nullValue())));
    final Logger logger = new SimpleLogger(Log.DEBUG);
    PagerAdaptersLogging.setLogger(logger);
    assertThat(PagerAdaptersLogging.getLogger(), is(logger));
}
AlchemyTest.java 文件源码 项目:alchemy 阅读 18 收藏 0 点赞 0 评论 0
@Test
public void delete() throws Exception {
    final List<User> users = User.generate(50, true);
    final List<User> fetched = mAlchemy.insert(users).fetch().list();
    final List<User> deleted = new ArrayList<>();
    for (final User user : fetched) {
        if (user.getId() % 2 == 0) {
            deleted.add(user);
        }
    }
    mAlchemy.delete(deleted).run();
    final List<User> allUsers = mAlchemy.where(User.class).fetch().list();
    Assert.assertThat(allUsers, IsNot.not(IterableContains.inAnyOrder(deleted)));
}
AlchemyTest.java 文件源码 项目:alchemy 阅读 19 收藏 0 点赞 0 评论 0
@Test
public void delete_by_where() throws Exception {
    final List<User> users = User.generate(50, true);
    mAlchemy.insert(users).run();
    final List<User> deleted = new ArrayList<>();
    for (final User user : deleted) {
        if (user.getAge() < 25) {
            deleted.add(user);
        }
    }
    mAlchemy.where(User.class).lessThan(UserContract.AGE, 25).delete().run();
    final List<User> allUsers = mAlchemy.where(User.class).fetch().list();
    Assert.assertThat(allUsers, IsNot.not(IterableContains.inAnyOrder(deleted)));
}
FragmentsLoggingTest.java 文件源码 项目:android_fragments 阅读 19 收藏 0 点赞 0 评论 0
@Test
public void testSetLogger() {
    FragmentsLogging.setLogger(null);
    assertThat(FragmentsLogging.getLogger(), is(IsNot.not(IsNull.nullValue())));
    final Logger logger = new SimpleLogger(Log.DEBUG);
    FragmentsLogging.setLogger(logger);
    assertThat(FragmentsLogging.getLogger(), is(logger));
}
JujacoreProgressServiceIntegrationTest.java 文件源码 项目:microservices 阅读 22 收藏 0 点赞 0 评论 0
@Ignore
@Test
public void fetchCodesFromRealSpreadsheet() throws Exception {
    final ProgressService service = JujacoreProgressServiceIntegrationTest
        .injector.getInstance(ProgressService.class);
    final Set<String> codes = service.codes();
    MatcherAssert.assertThat(
        codes, IsCollectionWithSize.hasSize(251)
    );
    MatcherAssert.assertThat(codes, IsNot.not(
        IsCollectionContaining.hasItem(""))
    );
}
BasicSerializationTest.java 文件源码 项目:offheap-store 阅读 18 收藏 0 点赞 0 评论 0
@Test
public void testPrimitiveClasses() {
  Portability<Serializable> p = new SerializablePortability();

  Class[] out = (Class[]) p.decode(p.encode(PRIMITIVE_CLASSES));

  Assert.assertThat(out, IsNot.not(IsSame.sameInstance(PRIMITIVE_CLASSES)));
  Assert.assertThat(out, IsEqual.equalTo(PRIMITIVE_CLASSES));
}
HttpRequestExecutorTest.java 文件源码 项目:nanorest 阅读 22 收藏 0 点赞 0 评论 0
@Before
public void setup() {
    mockService = new MockCallableHttpService();
    endpoint = directory.getEndpoint(GreetingsService.class);
    assertThat(endpoint, is(IsNot.not(IsNull.nullValue())));
    httpRequestExecutor = new HttpRequestExecutor();
}
HttpContextFactoryTest.java 文件源码 项目:motech 阅读 17 收藏 0 点赞 0 评论 0
@Test
public void shouldCreateFileSystemAwareUiHttpContext() {
    HttpContext httpContext = mock(HttpContext.class);
    PowerMockito.mockStatic(ApplicationEnvironment.class);

    MockBundle bundle = new MockBundle("org.motechproject.com-sms-api-bundle");

    when(ApplicationEnvironment.isInDevelopmentMode()).thenReturn(true);
    when(ApplicationEnvironment.getModulePath(new BundleName("org.motechproject.com-sms-api-bundle"))).thenReturn("/Users/s/project/motech/modules/sms/src/main/resources");

    FileSystemAwareUIHttpContext fileSystemAwareUIHttpContext = (FileSystemAwareUIHttpContext) HttpContextFactory.getHttpContext(httpContext, bundle);
    assertThat(fileSystemAwareUIHttpContext, IsNot.not(notNull()));

    assertThat(fileSystemAwareUIHttpContext.getResourceRootDirectoryPath(), Is.is("/Users/s/project/motech/modules/sms/src/main/resources"));
}


问题


面经


文章

微信
公众号

扫码关注公众号