### Question:
TagTemplateProcessor { public String process(String sourceTemplate, TagPreparationObject model) throws IOException { long started = System.currentTimeMillis(); String generatedTemplate = generateTemplateWithParameters(sourceTemplate, model); long generationTime = System.currentTimeMillis() - started; LOGGER.debug("The template text processed successfully by the EL based template processor under {} ms, the text after processing is: {}", generationTime, JsonUtil.minify(generatedTemplate)); return generatedTemplate; }  String process(String sourceTemplate, TagPreparationObject model);  }### Answer:
@Test void testProcessWhenTemplateIsEmptyString() throws IOException { String emptyString = ""; String actual = underTest.process(emptyString, getTagPreparationObject()); Assertions.assertEquals(emptyString, actual); }
@Test void testProcessWhenModelDoesNotHavePropertyThatIsReferencedFromTemplate() throws IOException { String notExistingExpressionReference = "{{{notExistingProperty}}}"; String actual = underTest.process(notExistingExpressionReference, getTagPreparationObject()); Assertions.assertEquals(notExistingExpressionReference, actual); }
@Test void testProcessWhenTemplateContainsSampleText() throws IOException { String anExampleTextValue = "anExampleTextValue"; String actual = underTest.process(anExampleTextValue, getTagPreparationObject()); Assertions.assertEquals(anExampleTextValue, actual); }
@Test void testProcessWhenModelDoesHavePropertyThatIsReferencedFromTemplateButNull() throws IOException { String accountIdReference = "{{{accountId}}}"; TagPreparationObject model = TagPreparationObject.Builder .builder() .build(); String actual = underTest.process(accountIdReference, model); Assertions.assertEquals(accountIdReference, actual); }
@Test void testProcessWhenModelDoesHavePropertyThatIsReferencedFromTemplateButEmptyString() throws IOException { String accountIdReference = "{{{accountId}}}"; String emptyString = ""; TagPreparationObject model = TagPreparationObject.Builder .builder() .withAccountId(emptyString) .build(); String actual = underTest.process(accountIdReference, model); Assertions.assertEquals(emptyString, actual); }
@Test void testProcessWhenModelDoesHaveMultiplePropertiesThatIsReferencedFromTemplate() throws IOException { String valuePattern = "%s and %s on %s"; String templateWithMultipleReference = String.format(valuePattern, "{{{accountId}}}", "{{{userName}}}", "{{{cloudPlatform}}}"); TagPreparationObject model = getTagPreparationObject(); String actual = underTest.process(templateWithMultipleReference, model); String expected = String.format(valuePattern, model.getAccountId(), model.getUserName(), model.getCloudPlatform()); Assertions.assertEquals(expected, actual); }