### Question:
NamePatternToIdEntry implements JSONable<NamePatternToIdEntry> { public boolean isMatching(String string) { if (string == null || regexp==null) { return false; } return regexp.matcher(string).matches(); } private  NamePatternToIdEntry(); @JsonCreator  NamePatternToIdEntry(@JsonProperty("namePattern")String namePattern,@JsonProperty("id") String id); static NamePatternToIdEntry createFromJSON(String json); String getNamePattern(); String getId(); boolean isMatching(String string); @Override Class<NamePatternToIdEntry> getJSONTargetClass(); @Override String toString();  }### Answer:
@Test public void name_pattern_abc_is_matching_abc_but_not_ab_or_null_or_not_abcd() { NamePatternToIdEntry entry = new NamePatternToIdEntry("abc","id1"); assertTrue(entry.isMatching("abc")); assertFalse(entry.isMatching("abcd")); assertFalse(entry.isMatching("ab")); assertFalse(entry.isMatching(null)); }
@Test public void name_pattern_abc_dot_star__is_matching_abc_and_abcd_but_not_ab_or_null() { NamePatternToIdEntry entry = new NamePatternToIdEntry("abc.*","id1"); assertTrue(entry.isMatching("abc")); assertTrue(entry.isMatching("abcd")); assertFalse(entry.isMatching("ab")); assertFalse(entry.isMatching(null)); }