Codota Logo
ListAssert.containsOnly
Code IndexAdd Codota to your IDE (free)

How to use
containsOnly
method
in
org.fest.assertions.ListAssert

Best Java code snippets using org.fest.assertions.ListAssert.containsOnly (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Dictionary d =
  • Codota Iconnew Hashtable()
  • Codota IconBundle bundle;bundle.getHeaders()
  • Codota Iconnew Properties()
  • Smart code suggestions by Codota
}
origin: debezium/debezium

@Test
public void shouldParseHostStringWithAddressesForOneReplicaSet() {
  sets = ReplicaSets.parse("myReplicaSet/localhost:27017,1.2.3.4:27017,localhost:28017,[fe80::601:9bff:feab:ec01]:27017");
  assertThat(sets.replicaSetCount()).isEqualTo(1);
  assertThat(sets.hosts()).isEqualTo("myReplicaSet/1.2.3.4:27017,[fe80::601:9bff:feab:ec01]:27017,localhost:27017,localhost:28017");
  rs = sets.all().get(0);
  assertThat(rs.hasReplicaSetName()).isTrue();
  assertThat(rs.isStandaloneServer()).isFalse();
  assertThat(rs.replicaSetName()).isEqualTo("myReplicaSet");
  assertThat(rs.shardName()).isNull();
  ServerAddress expected1 = new ServerAddress("1.2.3.4", 27017);
  ServerAddress expected2 = new ServerAddress("[fe80::601:9bff:feab:ec01]", 27017);
  ServerAddress expected3 = new ServerAddress("localhost", 27017);
  ServerAddress expected4 = new ServerAddress("localhost", 28017);
  assertThat(rs.addresses().size()).isEqualTo(4);
  assertThat(rs.addresses()).containsOnly(expected1, expected2, expected3, expected4);
}
origin: debezium/debezium

@Test
public void shouldParseHostStringWithAddressesForOneShard() {
  sets = ReplicaSets.parse("shard1=myReplicaSet/localhost:27017,1.2.3.4:27017,localhost:28017,[fe80::601:9bff:feab:ec01]:27017");
  assertThat(sets.replicaSetCount()).isEqualTo(1);
  assertThat(sets.hosts()).isEqualTo("shard1=myReplicaSet/1.2.3.4:27017,[fe80::601:9bff:feab:ec01]:27017,localhost:27017,localhost:28017");
  rs = sets.all().get(0);
  assertThat(rs.hasReplicaSetName()).isTrue();
  assertThat(rs.isStandaloneServer()).isFalse();
  assertThat(rs.replicaSetName()).isEqualTo("myReplicaSet");
  assertThat(rs.shardName()).isEqualTo("shard1");
  ServerAddress expected1 = new ServerAddress("1.2.3.4", 27017);
  ServerAddress expected2 = new ServerAddress("[fe80::601:9bff:feab:ec01]", 27017);
  ServerAddress expected3 = new ServerAddress("localhost", 27017);
  ServerAddress expected4 = new ServerAddress("localhost", 28017);
  assertThat(rs.addresses().size()).isEqualTo(4);
  assertThat(rs.addresses()).containsOnly(expected1, expected2, expected3, expected4);
}
origin: debezium/debezium

@Test
public void shouldParseHostStringWithStandaloneAddresses() {
  sets = ReplicaSets.parse("localhost:27017,1.2.3.4:27017,localhost:28017,[fe80::601:9bff:feab:ec01]:27017");
  assertThat(sets.replicaSetCount()).isEqualTo(1);
  assertThat(sets.hosts()).isEqualTo("1.2.3.4:27017,[fe80::601:9bff:feab:ec01]:27017,localhost:27017,localhost:28017");
  rs = sets.all().get(0);
  assertThat(rs.hasReplicaSetName()).isFalse();
  assertThat(rs.isStandaloneServer()).isTrue();
  assertThat(rs.replicaSetName()).isNull();
  assertThat(rs.shardName()).isNull();
  ServerAddress expected1 = new ServerAddress("1.2.3.4", 27017);
  ServerAddress expected2 = new ServerAddress("[fe80::601:9bff:feab:ec01]", 27017);
  ServerAddress expected3 = new ServerAddress("localhost", 27017);
  ServerAddress expected4 = new ServerAddress("localhost", 28017);
  assertThat(rs.addresses().size()).isEqualTo(4);
  assertThat(rs.addresses()).containsOnly(expected1, expected2, expected3, expected4);
}
origin: debezium/debezium

@Test
public void shouldParseHostStringWithAddressesForMultipleShard() {
  sets = ReplicaSets.parse("shard1=myReplicaSet/host1:27017,[fe80::601:9bff:feab:ec01]:27017;shard2=otherReplicaset/1.2.3.4:27017,localhost:28017");
  assertThat(sets.replicaSetCount()).isEqualTo(2);
  assertThat(sets.hosts()).isEqualTo("shard1=myReplicaSet/[fe80::601:9bff:feab:ec01]:27017,host1:27017;shard2=otherReplicaset/1.2.3.4:27017,localhost:28017");
  rs = sets.all().get(0);
  assertThat(rs.hasReplicaSetName()).isTrue();
  assertThat(rs.isStandaloneServer()).isFalse();
  assertThat(rs.replicaSetName()).isEqualTo("myReplicaSet");
  assertThat(rs.shardName()).isEqualTo("shard1");
  ServerAddress expected1 = new ServerAddress("[fe80::601:9bff:feab:ec01]", 27017);
  ServerAddress expected2 = new ServerAddress("host1", 27017);
  assertThat(rs.addresses().size()).isEqualTo(2);
  assertThat(rs.addresses()).containsOnly(expected1, expected2);
  rs = sets.all().get(1);
  assertThat(rs.hasReplicaSetName()).isTrue();
  assertThat(rs.isStandaloneServer()).isFalse();
  assertThat(rs.replicaSetName()).isEqualTo("otherReplicaset");
  assertThat(rs.shardName()).isEqualTo("shard2");
  expected1 = new ServerAddress("1.2.3.4", 27017);
  expected2 = new ServerAddress("localhost", 28017);
  assertThat(rs.addresses().size()).isEqualTo(2);
  assertThat(rs.addresses()).containsOnly(expected1, expected2);
}
origin: debezium/debezium

@Test
public void shouldParseHostStringWithAddressesForMultipleReplicaSet() {
  sets = ReplicaSets.parse("myReplicaSet/host1:27017,[fe80::601:9bff:feab:ec01]:27017;otherReplicaset/1.2.3.4:27017,localhost:28017");
  assertThat(sets.replicaSetCount()).isEqualTo(2);
  assertThat(sets.hosts()).isEqualTo("myReplicaSet/[fe80::601:9bff:feab:ec01]:27017,host1:27017;otherReplicaset/1.2.3.4:27017,localhost:28017");
  rs = sets.all().get(0);
  assertThat(rs.hasReplicaSetName()).isTrue();
  assertThat(rs.isStandaloneServer()).isFalse();
  assertThat(rs.replicaSetName()).isEqualTo("myReplicaSet");
  assertThat(rs.shardName()).isNull();
  ServerAddress expected1 = new ServerAddress("[fe80::601:9bff:feab:ec01]", 27017);
  ServerAddress expected2 = new ServerAddress("host1", 27017);
  assertThat(rs.addresses().size()).isEqualTo(2);
  assertThat(rs.addresses()).containsOnly(expected1, expected2);
  rs = sets.all().get(1);
  assertThat(rs.hasReplicaSetName()).isTrue();
  assertThat(rs.isStandaloneServer()).isFalse();
  assertThat(rs.replicaSetName()).isEqualTo("otherReplicaset");
  assertThat(rs.shardName()).isNull();
  expected1 = new ServerAddress("1.2.3.4", 27017);
  expected2 = new ServerAddress("localhost", 28017);
  assertThat(rs.addresses().size()).isEqualTo(2);
  assertThat(rs.addresses()).containsOnly(expected1, expected2);
}
origin: debezium/debezium

@Test
public void shouldPopulateToastableColumnsCache() throws Exception {
  String statements = "CREATE SCHEMA IF NOT EXISTS public;" +
      "DROP TABLE IF EXISTS table1;" +
      "CREATE TABLE table1 (pk SERIAL,  toasted text, untoasted int, PRIMARY KEY(pk));";
  TestHelper.execute(statements);
  PostgresConnectorConfig config = new PostgresConnectorConfig(TestHelper.defaultConfig().build());
  schema = TestHelper.getSchema(config);
  TableId tableId = TableId.parse("public.table1", false);
  // Before refreshing, we should have an empty array for the table
  assertTrue(schema.getToastableColumnsForTableId(tableId).isEmpty());
  try (PostgresConnection connection = TestHelper.create()) {
    // Load up initial schema info. This should not populate the toastable columns cache, as the cache is loaded
    // on-demand per-table refresh.
    schema.refresh(connection, false);
    assertTrue(schema.getToastableColumnsForTableId(tableId).isEmpty());
    // After refreshing w/ toastable column refresh disabled, we should still have an empty array
    schema.refresh(connection, tableId, false);
    assertTrue(schema.getToastableColumnsForTableId(tableId).isEmpty());
    // After refreshing w/ toastable column refresh enabled, we should have only the 'toasted' column in the cache
    schema.refresh(connection, tableId, true);
    assertThat(schema.getToastableColumnsForTableId(tableId)).containsOnly("toasted");
  }
}
origin: debezium/debezium

@Test
public void shouldParseHostStringWithStandaloneAddress() {
  sets = ReplicaSets.parse("localhost:27017");
  assertThat(sets.replicaSetCount()).isEqualTo(1);
  assertThat(sets.hosts()).isEqualTo("localhost:27017");
  rs = sets.all().get(0);
  assertThat(rs.hasReplicaSetName()).isFalse();
  assertThat(rs.isStandaloneServer()).isTrue();
  assertThat(rs.replicaSetName()).isNull();
  assertThat(rs.shardName()).isNull();
  ServerAddress expected = new ServerAddress("localhost", 27017);
  assertThat(rs.addresses().size()).isEqualTo(1);
  assertThat(rs.addresses()).containsOnly(expected);
}
origin: debezium/debezium

@Test
public void shouldParseHostStringWithIpv6AddressForOneReplicaSet() {
  sets = ReplicaSets.parse("myReplicaSet/[fe80::601:9bff:feab:ec01]:27017");
  assertThat(sets.replicaSetCount()).isEqualTo(1);
  assertThat(sets.hosts()).isEqualTo("myReplicaSet/[fe80::601:9bff:feab:ec01]:27017");
  rs = sets.all().get(0);
  assertThat(rs.hasReplicaSetName()).isTrue();
  assertThat(rs.isStandaloneServer()).isFalse();
  assertThat(rs.replicaSetName()).isEqualTo("myReplicaSet");
  assertThat(rs.shardName()).isNull();
  ServerAddress expected = new ServerAddress("[fe80::601:9bff:feab:ec01]", 27017);
  assertThat(rs.addresses().size()).isEqualTo(1);
  assertThat(rs.addresses()).containsOnly(expected);
}
origin: debezium/debezium

@Test
public void shouldParseHostStringWithAddressForOneReplicaSet() {
  sets = ReplicaSets.parse("myReplicaSet/localhost:27017");
  assertThat(sets.replicaSetCount()).isEqualTo(1);
  assertThat(sets.hosts()).isEqualTo("myReplicaSet/localhost:27017");
  rs = sets.all().get(0);
  assertThat(rs.hasReplicaSetName()).isTrue();
  assertThat(rs.isStandaloneServer()).isFalse();
  assertThat(rs.replicaSetName()).isEqualTo("myReplicaSet");
  assertThat(rs.shardName()).isNull();
  ServerAddress expected = new ServerAddress("localhost", 27017);
  assertThat(rs.addresses().size()).isEqualTo(1);
  assertThat(rs.addresses()).containsOnly(expected);
}
origin: debezium/debezium

  .collect(Collectors.toList());
assertThat(mytableColumnNames).containsOnly("def");
origin: debezium/debezium

assertThat(primary.collections()).containsOnly(new CollectionId(replicaSet.replicaSetName(), "dbA", "moviesA"));
origin: debezium/debezium

  .collect(Collectors.toList());
assertThat(mytableColumnNames).containsOnly("def");
origin: debezium/debezium

@Test
public void shouldAllowAddingPrimaryKeyColumnWhenFound() {
  editor.tableId(id);
  Column c1 = columnEditor.name("C1").type("VARCHAR").jdbcType(Types.VARCHAR).length(10).position(1).create();
  Column c2 = columnEditor.name("C2").type("NUMBER").jdbcType(Types.NUMERIC).length(5).position(1).create();
  Column c3 = columnEditor.name("C3").type("DATE").jdbcType(Types.DATE).position(1).create();
  editor.addColumns(c1, c2, c3);
  editor.setPrimaryKeyNames("C1");
  c1 = editor.columnWithName(c1.name());
  c2 = editor.columnWithName(c2.name());
  c3 = editor.columnWithName(c3.name());
  assertThat(c1.position()).isEqualTo(1);
  assertThat(c2.position()).isEqualTo(2);
  assertThat(c3.position()).isEqualTo(3);
  table = editor.create();
  assertThat(table.retrieveColumnNames()).containsExactly("C1", "C2", "C3");
  assertThat(table.columns()).containsExactly(c1, c2, c3);
  assertThat(table.primaryKeyColumnNames()).containsOnly("C1");
  assertValidPositions(editor);
}
origin: debezium/debezium

assertThat(person).isNotNull();
assertThat(person.filterColumns(col->col.isAutoIncremented())).isEmpty();
assertThat(person.primaryKeyColumnNames()).containsOnly("name");
assertThat(person.retrieveColumnNames()).containsExactly("name","birthdate","age","salary","bitStr");
assertThat(person.columnWithName("name").name()).isEqualTo("name");
Table product = tables.forTable(DATABASE.getDatabaseName(), null, "product");
assertThat(product).isNotNull();
assertThat(product.filterColumnNames(Column::isAutoIncremented)).containsOnly("id");
assertThat(product.primaryKeyColumnNames()).containsOnly("id");
assertThat(product.retrieveColumnNames()).containsExactly("id","createdByDate","modifiedDate");
assertThat(product.columnWithName("id").name()).isEqualTo("id");
assertThat(purchased).isNotNull();
assertThat(person.filterColumns(col->col.isAutoIncremented())).isEmpty();
assertThat(purchased.primaryKeyColumnNames()).containsOnly("productId","purchaser");
assertThat(purchased.retrieveColumnNames()).containsExactly("purchaser","productId","purchaseDate");
assertThat(purchased.columnWithName("purchaser").name()).isEqualTo("purchaser");
origin: hibernate/hibernate-ogm

@Test
public void canUseEnumAsParameterForSimpleComparison() {
  EntityManager entityManager = getFactory().createEntityManager();
  entityManager.getTransaction().begin();
  List<Movie> thrillers = entityManager.createQuery( "SELECT m FROM Movie m WHERE m.genre = :genre", Movie.class )
    .setParameter( "genre", Genre.THRILLER )
    .getResultList();
  assertThat( thrillers ).onProperty( "title" ).containsOnly( "South by Southeast", "Front Door" );
  entityManager.getTransaction().commit();
  entityManager.close();
}
origin: hibernate/hibernate-ogm

@Test
public void canUseBooleanAsParameterForSimpleComparison() {
  EntityManager entityManager = getFactory().createEntityManager();
  entityManager.getTransaction().begin();
  List<Movie> thrillers = entityManager.createQuery( "SELECT m FROM Movie m WHERE m.suitableForKids = :suitable", Movie.class )
    .setParameter( "suitable", Boolean.FALSE )
    .getResultList();
  assertThat( thrillers ).onProperty( "title" ).containsOnly( "Front Door", "Barnie" );
  entityManager.getTransaction().commit();
  entityManager.close();
}
origin: hibernate/hibernate-ogm

@Test
public void canUseDateParameterForSimpleComparison() {
  EntityManager entityManager = getFactory().createEntityManager();
  entityManager.getTransaction().begin();
  List<Movie> thrillers = entityManager.createQuery( "SELECT m FROM Movie m WHERE m.releaseDate = :releaseDate", Movie.class )
    .setParameter( "releaseDate", new GregorianCalendar( 1958, 3, 2 ).getTime() )
    .getResultList();
  assertThat( thrillers ).onProperty( "title" ).containsOnly( "South by Southeast" );
  entityManager.getTransaction().commit();
  entityManager.close();
}
origin: hibernate/hibernate-ogm

@Test
public void canUseQueriesWithEnumAsParameterForInQuery() {
  EntityManager entityManager = getFactory().createEntityManager();
  entityManager.getTransaction().begin();
  List<Movie> thrillers = entityManager.createQuery( "SELECT m FROM Movie m WHERE m.genre IN (:genre)", Movie.class )
    .setParameter( "genre", EnumSet.of( Genre.DRAMA, Genre.COMEDY ) )
    .getResultList();
  assertThat( thrillers ).onProperty( "title" ).containsOnly( "To thatch a roof", "Barnie" );
  entityManager.getTransaction().commit();
  entityManager.close();
}
origin: hibernate/hibernate-ogm

@Test
public void canUseByteForSimpleComparison() {
  EntityManager entityManager = getFactory().createEntityManager();
  entityManager.getTransaction().begin();
  List<Movie> thrillers = entityManager.createQuery( "SELECT m FROM Movie m WHERE m.viewerRating = 8", Movie.class )
    .getResultList();
  assertThat( thrillers ).onProperty( "title" ).containsOnly( "To thatch a roof" );
  entityManager.getTransaction().commit();
  entityManager.close();
}
origin: hibernate/hibernate-ogm

@Test
@Ignore("TODO HQLPARSER-59")
public void canUseDateLiteralForSimpleComparison() {
  EntityManager entityManager = getFactory().createEntityManager();
  entityManager.getTransaction().begin();
  List<Movie> thrillers = entityManager.createQuery( "SELECT m FROM Movie m WHERE m.releaseDate = '02 April 1958'", Movie.class )
    .getResultList();
  assertThat( thrillers ).onProperty( "title" ).containsOnly( "South by Southeast" );
  entityManager.getTransaction().commit();
  entityManager.close();
}
org.fest.assertionsListAssertcontainsOnly

Popular methods of ListAssert

  • hasSize
  • isEmpty
  • isEqualTo
  • containsExactly
  • as
  • isNotNull
  • contains
  • isNotEmpty
  • isNull
  • containsSequence
  • excludes
  • isNullOrEmpty
  • excludes,
  • isNullOrEmpty,
  • overridingErrorMessage,
  • isSameAs,
  • onProperty

Popular in Java

  • Making http requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • getSystemService (Context)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Dictionary (java.util)
    The Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to valu
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now