### Question:
HTMLDisplayerScriptService implements ScriptService { public String display(Type type, Object value) throws HTMLDisplayerException { return htmlDisplayerManager.display(type, value); }  String display(Type type, Object value); String display(Type type, Object value, Map<String, String> parameters); String display(Type type, Object value, Map<String, String> parameters, String mode);  }### Answer:
@Test public void HTMLDisplayerScriptServiceTest() throws Exception { Answer answer = i -> { String attributes = ""; if (i.getArguments().length > 2) { attributes = i.<Map<String, String>>getArgument(2).entrySet().stream() .map(entry -> entry.getKey() + "='" + entry.getValue() + "'") .collect(Collectors.joining(" ")); } return "<input " + attributes + ">" + i.getArgument(1) + "</input>"; }; when(htmlDisplayerManager.display(any(), anyString())).thenAnswer(answer); when(htmlDisplayerManager.display(any(), anyString(), anyMap())).thenAnswer(answer); when(htmlDisplayerManager.display(any(), anyString(), anyMap(), anyString())).thenAnswer(answer); Map<String, String> parameters = new LinkedHashMap<String, String>(){{ put("id", "testId"); put("class", "testClass"); }}; assertEquals("<input >test</input>", this.htmlDisplayerScriptService.display(String.class, "test")); assertEquals("<input id='testId' class='testClass'>test</input>", this.htmlDisplayerScriptService.display(String.class, "test", parameters)); assertEquals("<input id='testId' class='testClass'>test</input>", this.htmlDisplayerScriptService.display(String.class, "test", parameters, "view")); }