|
17 | 17 | */
|
18 | 18 | package com.jgaap.canonicizers;
|
19 | 19 |
|
20 |
| -import static org.junit.Assert.assertTrue; |
21 |
| - |
22 |
| -import java.util.Arrays; |
23 |
| - |
24 | 20 | import org.junit.Test;
|
25 | 21 |
|
26 |
| -import com.jgaap.generics.CanonicizationException; |
| 22 | +import static org.junit.Assert.assertArrayEquals; |
27 | 23 |
|
28 | 24 | /**
|
29 | 25 | * Unit test for the Smash I canonicizer.
|
|
33 | 29 | */
|
34 | 30 | public class SmashITest {
|
35 | 31 | @Test
|
36 |
| - public void testProcess() throws CanonicizationException { |
| 32 | + public void testProcess() { |
37 | 33 | SmashI smashI = new SmashI();
|
38 | 34 |
|
39 | 35 | // Test 1 - I on ends
|
40 | 36 | String in = "I don't care if IPad is supposed to be spelled with a lowercase I";
|
41 | 37 | char[] correct = "i don't care if IPad is supposed to be spelled with a lowercase i".toCharArray();
|
42 | 38 | char[] actual = smashI.process(in.toCharArray());
|
43 |
| - assertTrue(Arrays.equals(correct, actual)); |
| 39 | + assertArrayEquals(correct, actual); |
44 | 40 |
|
45 | 41 | // Test 2 - I in middle surrounded by spaces
|
46 | 42 | in = "Sometimes I cannot think of creative things to write for unit tests.";
|
47 | 43 | correct = "Sometimes i cannot think of creative things to write for unit tests.".toCharArray();
|
48 | 44 | actual = smashI.process(in.toCharArray());
|
49 |
| - assertTrue(Arrays.equals(correct, actual)); |
| 45 | + assertArrayEquals(correct, actual); |
50 | 46 |
|
51 | 47 | // Test 3 - I in middle surrounded by tabs
|
52 | 48 | in = "Sometimes I cannot think of creative things to write for unit tests.";
|
53 | 49 | correct = in.toCharArray();
|
54 | 50 | correct[11] = 'i';
|
55 | 51 | actual = smashI.process(in.toCharArray());
|
56 |
| - assertTrue(Arrays.equals(correct, actual)); |
| 52 | + assertArrayEquals(correct, actual); |
57 | 53 |
|
58 | 54 | // Test 4 - Bunch of I's next to each other with varying case
|
59 | 55 | in = "iIiIiiIIiiiiiiIIiiIiIiIIiiIIiiIiiIiiIIiiiIiiiIiI";
|
60 | 56 | correct = in.toCharArray();
|
61 | 57 | actual = smashI.process(in.toCharArray());
|
62 |
| - assertTrue(Arrays.equals(correct, actual)); |
| 58 | + assertArrayEquals(correct, actual); |
| 59 | + |
| 60 | + // Test 5 - Non-whitespaced I |
| 61 | + in = "\"I am here\", she said."; |
| 62 | + correct = "\"i am here\", she said.".toCharArray(); |
| 63 | + actual = smashI.process(in.toCharArray()); |
| 64 | + assertArrayEquals(correct, actual); |
| 65 | + |
| 66 | + // Test 6 - Non-whitespaced I |
| 67 | + in = "I'm here."; |
| 68 | + correct = "i'm here.".toCharArray(); |
| 69 | + actual = smashI.process(in.toCharArray()); |
| 70 | + assertArrayEquals(correct, actual); |
| 71 | + |
| 72 | + // Test 7 - Non-whitespaced I |
| 73 | + in = "It is I."; |
| 74 | + correct = "It is i.".toCharArray(); |
| 75 | + actual = smashI.process(in.toCharArray()); |
| 76 | + assertArrayEquals(correct, actual); |
63 | 77 | }
|
64 | 78 | }
|
0 commit comments