### Question:
GoTemplateSanitizer implements YamlSanitizer { public String sanitize(String source, YamlSanitizerContext context) { int index = source.indexOf(GO_TEMPLATE_START); if (index == -1) { return source; } String sourceNoLeading = sanitizeGoTemplatesWithoutContentBefore(source); String sourceResult = sanitizeGoTemplatesAfterCharacters(context, sourceNoLeading); return sourceResult; }  String sanitize(String source, YamlSanitizerContext context); static final Pattern PATTERN_CURLYBRACES_OPEN; static final Pattern PATTERN_CURLYBRACES_CLOSE; static final Pattern PATTERN_TO_REDUCED_INSIDE; }### Answer:
@Test public void empty_text_still_empty_text() { assertEquals("", supportToTest.sanitize("", new YamlSanitizerContext())); }
@Test public void normal_text_is_not_changed() { assertEquals("normal text", supportToTest.sanitize("normal text", new YamlSanitizerContext())); }
@Test public void normal_text_is_not_has_no_sanitizer_message() { YamlSanitizerContext context = new YamlSanitizerContext(); supportToTest.sanitize("normal text", context); assertFalse(context.hasSanitizerMessage()); assertEquals(0, context.getSanitizerMessages().size()); }
@Test public void sanitized_text_contains_one_sanitizer_message() { YamlSanitizerContext context = new YamlSanitizerContext(); supportToTest.sanitize("{{.A_VARIABLE}}", context); assertTrue(context.hasSanitizerMessage()); assertEquals(1, context.getSanitizerMessages().size()); }
@Test public void normal_templateVariable1_text_is_changed() { assertEquals("normal (( .TEMPLATE_VARIABLE1 ))-text", supportToTest.sanitize("normal {{ .TEMPLATE_VARIABLE1 }}-text", new YamlSanitizerContext())); }
@Test public void starting_templateVariable1_text_is_changed() { assertEquals("#(( .TEMPLATE_VARIABLE1 ))-text", supportToTest.sanitize("{{ .TEMPLATE_VARIABLE1 }}-text", new YamlSanitizerContext())); }
@Test public void starting_spaces_3_templateVariable1_text_is_changed() { assertEquals("# (( .TEMPLATE_VARIABLE1 ))-text", supportToTest.sanitize(" {{ .TEMPLATE_VARIABLE1 }}-text", new YamlSanitizerContext())); }
@Test public void complex_part_with_double_quotes_iniide_will_be_reduced() { assertEquals("chart: \"(( .Chart.Name ))-(( .Chart.Version _ replace _+_ ___ ))\"", supportToTest.sanitize("chart: \"{{ .Chart.Name }}-{{ .Chart.Version | replace \"+\" \"_\" }}\"", new YamlSanitizerContext())); }