CollectionId implements DataCollectionId { public static CollectionId parse(String replicaSetName, String str) { final int dotPosition = str.indexOf('.'); if (dotPosition == -1 || (dotPosition + 1) == str.length() || dotPosition == 0) { return null; } return new CollectionId(replicaSetName, str.substring(0, dotPosition), str.substring(dotPosition + 1)); } CollectionId(String replicaSetName, String dbName, String collectionName); static CollectionId parse(String replicaSetName, String str); String name(); String dbName(); String replicaSetName(); @Override String identifier(); @Override int hashCode(); @Override boolean equals(Object obj); String namespace(); @Override String toString();  }
@Test public void shouldNotParseStringWithDotAtStart() { assertThat(CollectionId.parse("rs0", ".a.b")).isNull(); }
@Test public void shouldNotParseStringWithDotAtEnd() { assertThat(CollectionId.parse("rs0", "a.")).isNull(); }
@Test public void shouldNotParseStringWithOneSegment() { assertThat(CollectionId.parse("rs0", "a")).isNull(); }