### Question:
RuleBasedPosTagger { public PosTag posTag(String input) { String token = input.toLowerCase(); if (lookup.containsKey(token)) { return lookup.get(token); } Map<PosTag, Integer> resLens = Maps.newHashMap(); for (Map.Entry<PosTag, List<String>> group : rules.entrySet()) { PosTag groupKey = group.getKey(); List<String> values = group.getValue(); if (groupKey == PosTag.PARTICIPLE) { applyParticipleRule(token, resLens, groupKey, values); } else if (groupKey == PosTag.CONJUCTION) { applyConjunctionRule(token, resLens, groupKey, values); } else { applyGeneralRule(token, resLens, groupKey, values); } } List<Entry<PosTag, Integer>> result = sortResults(resLens); if (result.isEmpty()) { return PosTag.OTHER; } else { Entry<PosTag, Integer> tag = result.get(0); return tag.getKey(); } }  PosTag posTag(String input);  }### Answer:
@Test public void testPosTag() { String[] split = text.split("\\s+"); for (String token : split) { String tag = tagger.posTag(token).getPennTag(); assertEquals(expecteTags.get(token), tag); } }
@Test public void someTestCases() { assertEquals(PosTag.CONJUCTION, tagger.posTag("и")); assertEquals(PosTag.CONJUCTION, tagger.posTag("поскольку")); assertEquals(PosTag.PREPOSITION, tagger.posTag("причем")); assertEquals(PosTag.PREPOSITION, tagger.posTag("между")); assertEquals(PosTag.VERB, tagger.posTag("называется")); assertEquals(PosTag.VERB, tagger.posTag("делится")); assertEquals(PosTag.ADVERB, tagger.posTag("только")); assertEquals(PosTag.PREPOSITION, tagger.posTag("пусть")); assertEquals(PosTag.NOUN, tagger.posTag("время")); }