### Question:
UtilsConfig { public String filterAction(Translate translate) { StringBuilder sb = new StringBuilder(); if (translate != null && translate.getAction() != null && StringUtils.isNotBlank(translate.getAction().name())) { switch (translate.getAction()) { case DATE: sb.append(" date { match => [\"" + translate.getKey() + "\", " + translate.getValue() + "]" + RETURN_BRACE); break; case ADD: sb.append(" mutate { add_field => {\"" + translate.getKey() + "\", \"" + translate.getValue() + "\"}" + RETURN_BRACE); break; case DELETE: sb.append(" mutate { remove_field => [\"" + translate.getKey() + "\"]" + RETURN_BRACE); break; case GROK: sb.append(" grok { match => {\"" + translate.getKey() + "\" => \"" + translate.getKeyPattern() + "\"}" + RETURN_BRACE); break; case RENAME: sb.append(" mutate { rename => {\"" + translate.getKey() + "\", \"" + translate.getValue() + "\"}" + RETURN_BRACE); break; default: log.error("Action not managed {}", translate); throw new RuntimeException("Action not managed : " + translate.toString()); } } return sb.toString(); }  String generateConfig(ConfigurationLogstash cl); String filterAction(Translate translate); String generateFilter(Translate translate); String generateOutput(ConfigurationOutput output); String generateInput(ConfigurationHost input);  }### Answer:
@Test public void filterAction_Date() { String result = utilsConfig.filterAction(generateFilterActionTranslate(TypeFilter.DATE)); assertThat(result).isEqualTo(" date { match => [\"keyTranslate\", valueTranslate] }\n"); }
@Test public void filterAction_Add() { String result = utilsConfig.filterAction(generateFilterActionTranslate(TypeFilter.ADD)); assertThat(result).isEqualTo(" mutate { add_field => {\"keyTranslate\", \"valueTranslate\"} }\n"); }
@Test public void filterAction_Grok() { String result = utilsConfig.filterAction(generateFilterActionTranslate(TypeFilter.GROK)); assertThat(result).isEqualTo(" grok { match => {\"keyTranslate\" => \"MYPATTERN2\"} }\n"); }