Created
June 5, 2018 22:41
-
-
Save davideanastasia/c6a6e8349a997772b6d7b3b310420eb7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class StopWordRemoveFnTest { | |
| static private class Empty {} | |
| static private final Empty EMPTY = new Empty(); | |
| @Test | |
| public void testDoFn() throws Exception { | |
| StopWordRemoveFn<Empty> doFn = new StopWordRemoveFn<>(); | |
| DoFnTester<KV<Empty, String>, KV<Empty, String>> fnTester = DoFnTester.of(doFn); | |
| List<KV<Empty, String>> output1 = fnTester.processBundle(KV.of(EMPTY, "dream")); | |
| assertEquals(1, output1.size()); | |
| assertEquals(KV.of(EMPTY, "dream"), output1.get(0)); | |
| List<KV<Empty, String>> output2 = fnTester.processBundle( | |
| KV.of(EMPTY, "be"), KV.of(EMPTY, "is"), KV.of(EMPTY, "night")); | |
| assertEquals(1, output2.size()); | |
| assertEquals(KV.of(EMPTY, "night"), output2.get(0)); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment