### Question:
KnownPhrasePreserver { public boolean[] preserveKnownPhrases(boolean [] boundaries) { for(TokenizedString phrase : knownPhrases) { int start = 0; while (start < tokens.tokens.length) { start = preservePhraseOccurrance(boundaries, phrase, start); } } return boundaries; } KnownPhrasePreserver(TokenizedString tokens, String knownPhrases); boolean[] preserveKnownPhrases(boolean [] boundaries);  }### Answer:
@Test public void testPreserve(){ KnownPhrasePreserver target = new KnownPhrasePreserver(tokens, "Software Test^ quality assurance"); boolean [] actual = target.preserveKnownPhrases(parsing.getBoundaries()); boolean [] expected = new boolean[] {false, true, true, false}; for(int i = 0; i < actual.length; ++i) { Assert.assertTrue(actual[i] == expected[i]); } }
@Test public void emptyPhrase(){ KnownPhrasePreserver target = new KnownPhrasePreserver(tokens, "Software Test^ "); boolean [] actual = target.preserveKnownPhrases(parsing.getBoundaries()); boolean [] expected = new boolean[] {false, true, true, true}; for(int i = 0; i < actual.length; ++i) { Assert.assertTrue(actual[i] == expected[i]); } }
@Test public void delimiters(){ KnownPhrasePreserver target = new KnownPhrasePreserver(tokensDelimiters, "Software-Test ^ quality / assurance"); boolean [] actual = target.preserveKnownPhrases(parsingDelimiters.getBoundaries()); boolean [] expected = new boolean[] {false, true, true, false}; for(int i = 0; i < actual.length; ++i) { Assert.assertTrue(actual[i] == expected[i]); } }