StrInterpolater implements Function<String, String> { @Override public String apply(String s) { return substitutor.replace(substitutor2.replace(s)); } StrInterpolater(ActivityDef... activityDefs);  StrInterpolater(Map<String,String> basicMap); protected  StrInterpolater(List<Map<String, String>> maps); @Override String apply(String s);  }
@Test public void shouldReturnIdentity() { String a = interp.apply("A"); assertThat(a).isEqualTo("A"); }
@Test public void shouldMatchSimpleSubst() { String a = interp.apply("<<akey>>"); assertThat(a).isEqualTo("aval1"); }
@Test public void shouldMatchAlternateSubst() { String a = interp.apply("TEMPLATE(akey)"); assertThat(a).isEqualTo("aval1"); String b = interp.apply("TEMPLATE(nokeymatches,value2)"); assertThat(b).isEqualTo("value2"); }
@Test public void shouldReturnWarningWhenUnmatched() { String a = interp.apply("<<nokeymatchesthis>>"); assertThat(a).isEqualTo("UNSET:nokeymatchesthis"); }
@Test public void shouldReturnDefaultWhenNotOverridden() { String a = interp.apply("<<nokeymatchesthis:butithasadefault>>"); assertThat(a).isEqualTo("butithasadefault"); }
@Test public void shouldOverrideDefault() { String a = interp.apply("<<bkey:bkeydefault>>"); assertThat(a).isEqualTo("bval1"); }
@Test public void shouldWorkWithOddCharacters() { String a = interp.apply("<<unchanged:{'parm1':'val1',parm2:val2, parm3: 'val3'}>>"); assertThat(a).isEqualTo("{'parm1':'val1',parm2:val2, parm3: 'val3'}"); }
@Test public void shouldWorkWithAllQuotes() { String a = interp.apply("<<Token:'Key': 'Value'>>"); assertThat(a).isEqualTo("'Key': 'Value'"); }
@Test public void shouldWorkWithAllQuotesOverride() { String a = interp.apply("<<Token:'Key': 'Value'>>"); assertThat(a).isEqualTo("'Key': 'Value'"); String b = interp.apply("<<json-a-b:'Key': 'Value'>>"); assertThat(b).isEqualTo("'a': 'b'"); }
@Test public void shouldWorkWithMultipleGroups() { String a = interp.apply("<<Token:'Key': 'Value'>>.<<Token2:'Stuff'>>"); assertThat(a).isEqualTo("'Key': 'Value'.'Stuff'"); }