### Question:
Locator implements Comparable<Locator> { protected boolean isValidDBKey(String dbKey, String delim) { return dbKey.contains(delim); } Locator(); private  Locator(String fullyQualifiedMetricName); @Override int hashCode(); @Override boolean equals(Object obj); String toString(); String getTenantId(); String getMetricName(); boolean equals(Locator other); static Locator createLocatorFromPathComponents(String tenantId, String... parts); static Locator createLocatorFromDbKey(String fullyQualifiedMetricName); @Override int compareTo(Locator o); static final String METRIC_TOKEN_SEPARATOR; static final String METRIC_TOKEN_SEPARATOR_REGEX; }### Answer:
@Test(expected = NullPointerException.class) public void isValidDBKeyThrowsExceptionOnNullDbKey() { Locator locator = new Locator(); locator.isValidDBKey(null, "a"); }
@Test(expected = NullPointerException.class) public void isValidDBKeyThrowsExceptionOnNullDelim() { Locator locator = new Locator(); locator.isValidDBKey("a.b.c", null); }
@Test public void isValidDBKeyUndelimitedStringReturnsFalse() { Locator locator = new Locator(); assertFalse(locator.isValidDBKey("abc", ".")); }
@Test public void isValidDBKeyDelimiterIsNormalCharInDbKeyReturnsTrue() { Locator locator = new Locator(); assertTrue(locator.isValidDBKey("abc", "b")); }
@Test public void isValidDBKeyDbKeyContainsDelimiterReturnsTrue() { Locator locator = new Locator(); assertTrue(locator.isValidDBKey("a.b.c", ".")); }
@Test public void isValidDBKeyEmptyDbKeyReturnsFalse() { Locator locator = new Locator(); assertFalse(locator.isValidDBKey("", ".")); }
@Test public void isValidDBKeyEmptyDelimiterReturnsTrue() { Locator locator = new Locator(); assertTrue(locator.isValidDBKey("a.b.c", "")); }
@Test public void isValidDBKeyMultiCharDelimiterReturnsTrue() { Locator locator = new Locator(); assertTrue(locator.isValidDBKey("a.b.c", ".b.")); }