### Question:
FieldName implements Serializable { @JsonCreator static public FieldName create(String value){ if(value == null){ throw new NullPointerException(); } else if(("").equals(value)){ throw new IllegalArgumentException("Name cannot be empty"); } Map<String, FieldName> cache = FieldName.CACHE_PROVIDER.get(); FieldName name = cache.get(value); if(name == null){ name = new FieldName(value); FieldName prevName = cache.putIfAbsent(value, name); if(prevName != null){ return prevName; } } return name; } private  FieldName(String value); @Override int hashCode(); @Override boolean equals(Object object); @Override String toString(); String getValue(); @JsonCreator static FieldName create(String value); static final Map<String, FieldName> CACHE; static final ThreadLocal<Map<String, FieldName>> CACHE_PROVIDER; }### Answer:
@Test public void create(){ FieldName name = FieldName.create("x"); FieldName createdName; Map<String, FieldName> cache = new HashMap<>(); try { FieldName.CACHE_PROVIDER.set(cache); createdName = FieldName.create("x"); assertEquals(name, createdName); assertNotSame(name, createdName); } finally { FieldName.CACHE_PROVIDER.remove(); } assertEquals(1, cache.size()); createdName = FieldName.create(new String("x")); assertSame(name, createdName); }