### Question:
AAIErrorFormatter { protected String fillInTemplate(String text, List<String> variables) { for (int i = 0; i < variables.size(); i++) { variables.set(i, this.format(variables.get(i), variables)); } return format(text, variables); } AAIErrorFormatter(AAIError error); String getMessage();  }### Answer:
@Test public void testFillInTemplateWithReplace() { String error = "Error %1 on %2"; List<String> list = Arrays.asList("PUT", "hello %1"); AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj); String result = formatter.fillInTemplate(error, list); assertEquals("equal", "Error PUT on hello PUT", result); }
@Test public void testFillInTemplateWithoutReplace() { String error = "Error"; List<String> list = new ArrayList<>(); AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj); String result = formatter.fillInTemplate(error, list); assertEquals("equal", "Error", result); }