@@ -41,38 +41,81 @@ public void testEquals(Object expected, Object actual, String testTitle) {
4141 }
4242 }
4343
44- public void testDoubleArrayEquals (double [] expected , double [] actual , String testTitle ) {
44+ public void doubleArrayEquals (double [] expected , double [] actual , String testTitle ) {
4545 if (Arrays .equals (expected , actual )) {
4646 printTestSuccess (testTitle );
4747 } else {
4848 printTestFailure (testTitle , toString (expected ), toString (actual ));
4949 }
5050 }
5151
52- public void testFloatArrayEquals (float [] expected , float [] actual , String testTitle ) {
52+ public void floatArrayEquals (float [] expected , float [] actual , String testTitle ) {
5353 if (Arrays .equals (expected , actual )) {
5454 printTestSuccess (testTitle );
5555 } else {
5656 printTestFailure (testTitle , toString (expected ), toString (actual ));
5757 }
5858 }
5959
60- public void testIntArrayEquals (int [] expected , int [] actual , String testTitle ) {
60+ public void intArrayEquals (int [] expected , int [] actual , String testTitle ) {
6161 if (Arrays .equals (expected , actual )) {
6262 printTestSuccess (testTitle );
6363 } else {
6464 printTestFailure (testTitle , toString (expected ), toString (actual ));
6565 }
6666 }
6767
68- public void testIntListofListsEquals (List <List <Integer >> expected , List <List <Integer >> actual , String testTitle ) {
68+ public void intListofListsEquals (List <List <Integer >> expected , List <List <Integer >> actual , String testTitle ) {
6969 if (expected .containsAll (actual )) {
7070 printTestSuccess (testTitle );
7171 } else {
7272 printTestFailure (testTitle , toString (expected ), toString (actual ));
7373 }
7474 }
7575
76+ public void booleanEquals (boolean expected , boolean actual , String testTitle ) {
77+ if (expected == actual ) {
78+ printTestSuccess (testTitle );
79+ } else {
80+ printTestFailure (testTitle , String .valueOf (expected ), String .valueOf (actual ));
81+ }
82+ }
83+
84+ public void listNodeEquals (ListNode expected , ListNode actual , String testTitle ) {
85+ if (expected == actual ) {
86+ printTestSuccess (testTitle );
87+ } else {
88+ printTestFailure (testTitle , String .valueOf (expected ), String .valueOf (actual ));
89+ }
90+ }
91+
92+ public void intEquals (int expected , int actual , String testTitle ) {
93+ if (expected == actual ) {
94+ printTestSuccess (testTitle );
95+ } else {
96+ printTestFailure (testTitle , String .valueOf (expected ), String .valueOf (actual ));
97+ }
98+ }
99+
100+ public void doubleEquals (double expected , double actual , String testTitle ) {
101+ if (expected == actual ) {
102+ printTestSuccess (testTitle );
103+ } else {
104+ printTestFailure (testTitle , String .valueOf (expected ), String .valueOf (actual ));
105+ }
106+ }
107+
108+ public void isNull (Object actual , String testTitle ) {
109+ if (actual == null ) {
110+ printTestSuccess (testTitle );
111+ } else {
112+ printTestFailure (testTitle , String .valueOf (null ), String .valueOf (actual ));
113+ }
114+ }
115+
116+
117+ // PRIVATE
118+
76119 private static String toString (int [] values ) {
77120 if (values == null ) {
78121 return "null" ;
@@ -151,48 +194,6 @@ private static String toString(Object[] values) {
151194 return str ;
152195 }
153196
154- public void booleanEquals (boolean expected , boolean actual , String testTitle ) {
155- if (expected == actual ) {
156- printTestSuccess (testTitle );
157- } else {
158- printTestFailure (testTitle , String .valueOf (expected ), String .valueOf (actual ));
159- }
160- }
161-
162- public void listNodeEquals (ListNode expected , ListNode actual , String testTitle ) {
163- if (expected == actual ) {
164- printTestSuccess (testTitle );
165- } else {
166- printTestFailure (testTitle , String .valueOf (expected ), String .valueOf (actual ));
167- }
168- }
169-
170- public void intEquals (int expected , int actual , String testTitle ) {
171- if (expected == actual ) {
172- printTestSuccess (testTitle );
173- } else {
174- printTestFailure (testTitle , String .valueOf (expected ), String .valueOf (actual ));
175- }
176- }
177-
178- public void doubleEquals (double expected , double actual , String testTitle ) {
179- if (expected == actual ) {
180- printTestSuccess (testTitle );
181- } else {
182- printTestFailure (testTitle , String .valueOf (expected ), String .valueOf (actual ));
183- }
184- }
185-
186- public void isNull (Object actual , String testTitle ) {
187- if (actual == null ) {
188- printTestSuccess (testTitle );
189- } else {
190- printTestFailure (testTitle , String .valueOf (null ), String .valueOf (actual ));
191- }
192- }
193-
194-
195- // PRIVATE
196197 private void updateTestCounter (String testTitle ) {
197198 if (!testCounter .containsKey (testTitle )) {
198199 testCounter .put (testTitle , 0 );
0 commit comments