### Question:
PatternDecorator extends AbstractConstraintAttributesDecorator { @Override public Set<Map.Entry<String, Object>> entrySet() { Set<Map.Entry<String, Object>> entrySet = getDecoratee().entrySet(); Map<String, Object> result = new HashMap<>(); for (Map.Entry<String, Object> entry : entrySet) { if ("regexp".equals(entry.getKey())) { result.put("value", javaToJavaScriptRegexpPattern(entry)); } else { result.put(entry.getKey(), entry.getValue()); } } return result.entrySet(); } PatternDecorator(ConstraintAttributes decoratee); @Override Set<Map.Entry<String, Object>> entrySet();  }### Answer:
@Test public void shouldStoreThePatternForValueAttribute() { regexPattern("abc"); PatternDecorator decorator = new PatternDecorator(constraintAttributes); Set<Map.Entry<String, Object>> decoratedEntries = decorator.entrySet(); assertThat(firstKeyFrom(decoratedEntries), is("value")); }
@Test public void shouldAddSlashPrefixSuffix() { regexPattern("abc"); PatternDecorator decorator = new PatternDecorator(constraintAttributes); Set<Map.Entry<String, Object>> decoratedEntries = decorator.entrySet(); assertThat(firstValueFrom(decoratedEntries), is("/abc/")); }
@Test public void shouldAddSlashPrefixSuffixForPatternStartingWithSlash() { regexPattern("/abc"); PatternDecorator decorator = new PatternDecorator(constraintAttributes); Set<Map.Entry<String, Object>> decoratedEntries = decorator.entrySet(); assertThat(firstValueFrom(decoratedEntries), is(" }