org.assertj.core.api.IterableAssert.doesNotContain()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(12.5k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中org.assertj.core.api.IterableAssert.doesNotContain()方法的一些代码示例,展示了IterableAssert.doesNotContain()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IterableAssert.doesNotContain()方法的具体详情如下:
包路径:org.assertj.core.api.IterableAssert
类名称:IterableAssert
方法名:doesNotContain

IterableAssert.doesNotContain介绍

暂无

代码示例

代码示例来源:origin: SonarSource/sonarqube

public void assertColumnDoesNotExist(String table, String column) throws SQLException {
 try (Connection connection = getConnection();
  PreparedStatement stmt = connection.prepareStatement("select * from " + table);
  ResultSet res = stmt.executeQuery()) {
  assertThat(getColumnNames(res)).doesNotContain(column);
 }
}

代码示例来源:origin: spring-projects/spring-security

@Test
public void hashLookupOnlyDependsOnUsername() throws Exception {
  User user1 = new User("rod", "koala", true, true, true, true, ROLE_12);
  Set<UserDetails> users = new HashSet<>();
  users.add(user1);
  assertThat(users).contains(new User("rod", "koala", true, true, true, true,
      ROLE_12));
  assertThat(users).contains(new User("rod", "anotherpass", false, false, false,
      false, AuthorityUtils.createAuthorityList("ROLE_X")));
  assertThat(users).doesNotContain(new User("bod", "koala", true, true, true, true,
      ROLE_12));
}

代码示例来源:origin: prestodb/presto

@Test
public void testRollback()
    throws SQLException
{
  try (Connection connection = createConnection()) {
    connection.setAutoCommit(false);
    try (Statement statement = connection.createStatement()) {
      statement.execute("CREATE TABLE test_rollback (x bigint)");
    }
    try (Connection otherConnection = createConnection()) {
      assertThat(listTables(otherConnection)).doesNotContain("test_rollback");
    }
    connection.rollback();
  }
  try (Connection connection = createConnection()) {
    assertThat(listTables(connection)).doesNotContain("test_rollback");
  }
}

代码示例来源:origin: prestodb/presto

@Test
public void testCommit()
    throws SQLException
{
  try (Connection connection = createConnection()) {
    connection.setAutoCommit(false);
    try (Statement statement = connection.createStatement()) {
      statement.execute("CREATE TABLE test_commit (x bigint)");
    }
    try (Connection otherConnection = createConnection()) {
      assertThat(listTables(otherConnection)).doesNotContain("test_commit");
    }
    connection.commit();
  }
  try (Connection connection = createConnection()) {
    assertThat(listTables(connection)).contains("test_commit");
  }
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void delete_existing_index() {
 underTest.deleteIndexes("a");
 assertThat(loadExistingIndices())
  .doesNotContain("a")
  .contains("b", "c");
 assertThat(logTester.logs(LoggerLevel.INFO))
  .contains("Drop Elasticsearch index [a]");
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void ignore_indices_that_do_not_exist() {
 underTest.deleteIndexes("a", "xxx", "c");
 assertThat(loadExistingIndices())
  .doesNotContain("a", "c")
  .contains("b");
 assertThat(logTester.logs(LoggerLevel.INFO))
  .contains("Drop Elasticsearch index [a]", "Drop Elasticsearch index [c]")
  .doesNotContain("Drop Elasticsearch index [xxx]");
}

代码示例来源:origin: andsel/moquette

@Test
public void testMatchSlashSingle() {
  Subscription slashPlusSub = clientSubOnTopic("AnySensor", "/+");
  sut.add(slashPlusSub);
  Subscription anySub = clientSubOnTopic("AnySensor", "+");
  sut.add(anySub);
  // Verify
  assertThat(sut.matchWithoutQosSharpening(asTopic("/finance"))).containsOnly(slashPlusSub);
  assertThat(sut.matchWithoutQosSharpening(asTopic("/finance"))).doesNotContain(anySub);
}

代码示例来源:origin: stagemonitor/stagemonitor

@Test
public void testStartMonitoringNotActive() throws Exception {
  when(corePlugin.isStagemonitorActive()).thenReturn(false);
  final MeasurementSession measurementSession = new MeasurementSession("StagemonitorTest", "testHost", "testInstance");
  Stagemonitor.reset(measurementSession);
  assertTrue(Stagemonitor.isDisabled());
  assertFalse(Stagemonitor.isStarted());
  assertTrue(Stagemonitor.getMeasurementSession().isInitialized());
  assertThat(healthCheckRegistry.getNames()).doesNotContain("TestPlugin", "TestExceptionPlugin");
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void select_organization_uuids_by_user_id() {
 OrganizationDto organizationDto1 = db.organizations().insert();
 OrganizationDto organizationDto2 = db.organizations().insert();
 OrganizationDto organizationDto3 = db.organizations().insert();
 underTest.insert(dbSession, create(organizationDto1.getUuid(), 512));
 underTest.insert(dbSession, create(organizationDto2.getUuid(), 512));
 assertThat(underTest.selectOrganizationUuidsByUser(dbSession, 512)).containsOnly(organizationDto1.getUuid(), organizationDto2.getUuid())
  .doesNotContain(organizationDto3.getUuid());
 assertThat(underTest.selectOrganizationUuidsByUser(dbSession, 123)).isEmpty();
}

代码示例来源:origin: andsel/moquette

@Test
public void testRemovalInnerTopicOffRootDiffClient() {
  sut.addToTree(clientSubOnTopic("TempSensor1", "temp"));
  sut.addToTree(clientSubOnTopic("TempSensor2", "temp/1"));
  //Exercise
  final Set<Subscription> matchingSubs1 = sut.recursiveMatch(asTopic("temp"));
  final Set<Subscription> matchingSubs2 = sut.recursiveMatch(asTopic("temp/1"));
  //Verify
  final Subscription expectedMatchingsub1 = new Subscription("TempSensor1", asTopic("temp"), MqttQoS.AT_MOST_ONCE);
  final Subscription expectedMatchingsub2 = new Subscription("TempSensor2", asTopic("temp/1"), MqttQoS.AT_MOST_ONCE);
  assertThat(matchingSubs1).contains(expectedMatchingsub1);
  assertThat(matchingSubs2).contains(expectedMatchingsub2);
  sut.removeFromTree(asTopic("temp"), "TempSensor1");
  //Exercise
  final Set<Subscription> matchingSubs3 = sut.recursiveMatch(asTopic("temp"));
  final Set<Subscription> matchingSubs4 = sut.recursiveMatch(asTopic("temp/1"));
  assertThat(matchingSubs3).doesNotContain(expectedMatchingsub1);
  assertThat(matchingSubs4).contains(expectedMatchingsub2);
}

代码示例来源:origin: andsel/moquette

@Test
public void testRemovalInnerTopicOffRootSameClient() {
  sut.addToTree(clientSubOnTopic("TempSensor1", "temp"));
  sut.addToTree(clientSubOnTopic("TempSensor1", "temp/1"));
  //Exercise
  final Set<Subscription> matchingSubs1 = sut.recursiveMatch(asTopic("temp"));
  final Set<Subscription> matchingSubs2 = sut.recursiveMatch(asTopic("temp/1"));
  //Verify
  final Subscription expectedMatchingsub1 = new Subscription("TempSensor1", asTopic("temp"), MqttQoS.AT_MOST_ONCE);
  final Subscription expectedMatchingsub2 = new Subscription("TempSensor1", asTopic("temp/1"), MqttQoS.AT_MOST_ONCE);
  assertThat(matchingSubs1).contains(expectedMatchingsub1);
  assertThat(matchingSubs2).contains(expectedMatchingsub2);
  sut.removeFromTree(asTopic("temp"), "TempSensor1");
  //Exercise
  final Set<Subscription> matchingSubs3 = sut.recursiveMatch(asTopic("temp"));
  final Set<Subscription> matchingSubs4 = sut.recursiveMatch(asTopic("temp/1"));
  assertThat(matchingSubs3).doesNotContain(expectedMatchingsub1);
  assertThat(matchingSubs4).contains(expectedMatchingsub2);
}

代码示例来源:origin: andsel/moquette

@Test
  public void testRemovalOuterTopicOffRootDiffClient() {
    sut.addToTree(clientSubOnTopic("TempSensor1", "temp"));
    sut.addToTree(clientSubOnTopic("TempSensor2", "temp/1"));

    //Exercise
    final Set<Subscription> matchingSubs1 = sut.recursiveMatch(asTopic("temp"));
    final Set<Subscription> matchingSubs2 = sut.recursiveMatch(asTopic("temp/1"));

    //Verify
    final Subscription expectedMatchingsub1 = new Subscription("TempSensor1", asTopic("temp"), MqttQoS.AT_MOST_ONCE);
    final Subscription expectedMatchingsub2 = new Subscription("TempSensor2", asTopic("temp/1"), MqttQoS.AT_MOST_ONCE);

    assertThat(matchingSubs1).contains(expectedMatchingsub1);
    assertThat(matchingSubs2).contains(expectedMatchingsub2);

    sut.removeFromTree(asTopic("temp/1"), "TempSensor2");

    //Exercise
    final Set<Subscription> matchingSubs3 = sut.recursiveMatch(asTopic("temp"));
    final Set<Subscription> matchingSubs4 = sut.recursiveMatch(asTopic("temp/1"));

    assertThat(matchingSubs3).contains(expectedMatchingsub1);
    assertThat(matchingSubs4).doesNotContain(expectedMatchingsub2);
  }
}

代码示例来源:origin: hcoles/pitest

private void assertDoesNotHitLine(final int classId, final int... i) {
 final Collection<Long> actual = CodeCoverageStore.getHits();
 for (final int probe : i) {
  assertThat(actual).doesNotContain(
    CodeCoverageStore.encode(classId, probe));
 }
}

代码示例来源:origin: palantir/atlasdb

@Test
public void getMetadataForTablesReturnsWithCorrectCapitalization() {
  kvs.createTable(UPPER_UPPER, AtlasDbConstants.GENERIC_TABLE_METADATA);
  assertThat(kvs.getMetadataForTables().keySet())
      .contains(UPPER_UPPER)
      .doesNotContain(LOWER_LOWER);
}

代码示例来源:origin: palantir/atlasdb

@Test
public void tablesDelegatedToSourceKvsGetDroppedFromSourceKvsIfMigratable() {
  fromKvs.createTable(FAKE_ATOMIC_TABLE, AtlasDbConstants.GENERIC_TABLE_METADATA);
  fromKvs.putUnlessExists(FAKE_ATOMIC_TABLE, ImmutableMap.of(TEST_CELL, TEST_VALUE1));
  KeyValueService toTableSplittingKvs = TableSplittingKeyValueService.create(
      ImmutableList.of(new InMemoryKeyValueService(false), fromKvs),
      ImmutableMap.of(FAKE_ATOMIC_TABLE, fromKvs));
  AtlasDbServices toSplittingServices = createMock(toTableSplittingKvs);
  ImmutableMigratorSpec spec  = ImmutableMigratorSpec.builder()
      .fromServices(fromServices)
      .toServices(toSplittingServices)
      .build();
  assertThat(toSplittingServices.getKeyValueService()
      .get(FAKE_ATOMIC_TABLE, ImmutableMap.of(TEST_CELL, 1L)).get(TEST_CELL).getContents())
      .containsExactly(TEST_VALUE1);
  KeyValueServiceMigrator migrator = KeyValueServiceMigrators.setupMigrator(spec);
  migrator.setup();
  assertThat(fromKvs.getAllTableNames()).doesNotContain(FAKE_ATOMIC_TABLE);
}

代码示例来源:origin: PegaSysEng/pantheon

@Test
public void rpcHttpHostWhitelistAcceptsMultipleFlags() {
 parseCommand("--host-whitelist=a", "--host-whitelist=b");
 verify(mockRunnerBuilder).jsonRpcConfiguration(jsonRpcConfigArgumentCaptor.capture());
 verify(mockRunnerBuilder).build();
 assertThat(jsonRpcConfigArgumentCaptor.getValue().getHostsWhitelist().size()).isEqualTo(2);
 assertThat(jsonRpcConfigArgumentCaptor.getValue().getHostsWhitelist()).contains("a", "b");
 assertThat(jsonRpcConfigArgumentCaptor.getValue().getHostsWhitelist())
   .doesNotContain("*", "localhost");
 assertThat(commandOutput.toString()).isEmpty();
 assertThat(commandErrorOutput.toString()).isEmpty();
}

代码示例来源:origin: PegaSysEng/pantheon

@Test
public void rpcHttpHostWhitelistAcceptsDoubleComma() {
 parseCommand("--host-whitelist", "a,,b");
 verify(mockRunnerBuilder).jsonRpcConfiguration(jsonRpcConfigArgumentCaptor.capture());
 verify(mockRunnerBuilder).build();
 assertThat(jsonRpcConfigArgumentCaptor.getValue().getHostsWhitelist().size()).isEqualTo(2);
 assertThat(jsonRpcConfigArgumentCaptor.getValue().getHostsWhitelist()).contains("a", "b");
 assertThat(jsonRpcConfigArgumentCaptor.getValue().getHostsWhitelist())
   .doesNotContain("*", "localhost");
 assertThat(commandOutput.toString()).isEmpty();
 assertThat(commandErrorOutput.toString()).isEmpty();
}

代码示例来源:origin: org.apache.james/james-server-jmap

@Test
public void toOutputPropertiesShouldReturnTextBodyWhenBodyRequested() {
  MessageProperties actual = new MessageProperties(Optional.of(ImmutableSet.of("body"))).toOutputProperties();
  assertThat(actual.getOptionalMessageProperties())
    .hasValueSatisfying(value -> 
      assertThat(value).contains(MessageProperty.textBody).doesNotContain(MessageProperty.body));
}

代码示例来源:origin: PegaSysEng/pantheon

@Test
public void shouldNotAddSelfWhenReceivedPingFromSelf() {
 startPeerDiscoveryController();
 final DiscoveryPeer localPeer =
   new DiscoveryPeer(this.localPeer.getId(), this.localPeer.getEndpoint());
 final Packet pingPacket = mockPingPacket(this.localPeer, this.localPeer);
 controller.onMessage(pingPacket, localPeer);
 assertThat(controller.getPeers()).doesNotContain(localPeer);
}

代码示例来源:origin: org.joinfaces/jsf-spring-boot-autoconfigure

@Test
public void testNullServletContextInitializer() {
  JsfClassFactoryConfiguration configuration = JsfClassFactoryConfiguration.builder()
      .excludeScopedAnnotations(true)
      .handlesTypes(null)
      .anotherConfig(null)
      .build();
  Set<Class<?>> classes = new JsfClassFactory(configuration).getAllClasses();
  assertThat(classes).doesNotContain(HtmlGridRenderer.class);
}

相关文章

微信公众号

最新文章

更多