### Question:
EscalationMessageProcessor { public String processBasicMessage(String template, Snapshot snapshot) { if (template == null || template.trim().isEmpty()) { return defaultMessage; } return replaceVariables(template, snapshot); }  @PostConstruct void init(); String processBasicMessage(String template, Snapshot snapshot); String processRichMessage(String template, Snapshot snapshot);  }### Answer:
@Test public void basic_replace_nothing() throws Exception { String expected = "This is a test"; Snapshot escalation = mock(Snapshot.class); String result = instance.processBasicMessage(expected, escalation); assertEquals(expected, result); }
@Test public void basic_replace_heap() throws Exception { String expected = "Used Heap: 42"; String template = "Used Heap: ${usedHeapSize}"; Snapshot snapshot = new Snapshot.Builder().usedHeapSize(42).build(); String result = instance.processBasicMessage(template, snapshot); assertEquals(expected, result); }
@Test public void basic_subvalue_replace() throws Exception { String expected = "Free Connections: 42"; String template = "Free Connections: ${pools[0].numconnfree}"; List<ConnectionPool> pools = new ArrayList<>(); pools.add(new ConnectionPool("anything", 42, 24, 1, 1)); Snapshot snapshot = new Snapshot.Builder().pools(pools).build(); String result = instance.processBasicMessage(template, snapshot); assertEquals(expected, result); }