### Question:
UrlDefinitionsToMessages { private void fillFormatDefinitions(Class<?>[] classes) { for (Class<?> class1 : classes) { if (Modifier.isInterface(class1.getModifiers())) { Field[] fields = class1.getDeclaredFields(); for (Field field : fields) { try { if (Modifier.isPublic(field.getModifiers()) && field.getName() .startsWith(PRAEFIX_PARAMETER)) { final ParamFormat format = field.getAnnotation(ParamFormat.class); final String paramName = field.get(null).toString(); if (formatDefinition.containsKey(paramName)) { LOG.warn("Parameter {} is defined more " + "than once.", paramName); } else { formatDefinition.put(paramName, ""); } if (format != null) { formatDefinition.put(paramName, format.value()); } } } catch (IllegalArgumentException | IllegalAccessException e) { LOG.error( "Error reading the field " + field.getDeclaringClass() + "." + field.getName(), e); } } fillFormatDefinitions(class1.getDeclaredClasses()); } } } UrlDefinitionsToMessages(Class<?>... classes); @Deprecated void addUrlsAsMessages(); void addUrlsAsMessagesWithPositionedParameters(); void addUrlsAsMessagesWithNamedParameters(); void addParamsAsMessages(); void addParamGroupAsMessages(); Properties getMessages(); static final String INTEGER; }### Answer:
@Test public void testFillFormatDefinitions() { final Map<String, String> formatDefinition = testee.getFormatDefinition(); Map<String, String> expectedMap = new HashMap<>(); expectedMap.put(TestClass.P_USERID, UrlDefinitionsToMessages.INTEGER); expectedMap.put(TestClass.InnerInterface.P_DUMMY, UrlDefinitionsToMessages.INTEGER); expectedMap.put(TestClass.P_STRANGE_FORMAT, ",xyz"); expectedMap.put(TestClass.P_USERNAME, ""); assertThat(formatDefinition).isEqualTo(expectedMap); }