Skip to content
This repository was archived by the owner on Oct 20, 2022. It is now read-only.

Commit 4347143

Browse files
Fix style issues in the tests.
1 parent 2370947 commit 4347143

24 files changed

+222
-148
lines changed

src/test/java/com/google/visualization/datasource/datatable/DataTableTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
import com.google.visualization.datasource.base.ReasonType;
1919
import com.google.visualization.datasource.base.TypeMismatchException;
2020
import com.google.visualization.datasource.base.Warning;
21-
import com.google.visualization.datasource.datatable.value.ValueType;
22-
import com.google.visualization.datasource.datatable.value.DateValue;
23-
import com.google.visualization.datasource.datatable.value.TimeOfDayValue;
21+
import com.google.visualization.datasource.datatable.value.BooleanValue;
2422
import com.google.visualization.datasource.datatable.value.DateTimeValue;
23+
import com.google.visualization.datasource.datatable.value.DateValue;
2524
import com.google.visualization.datasource.datatable.value.NumberValue;
26-
import com.google.visualization.datasource.datatable.value.BooleanValue;
2725
import com.google.visualization.datasource.datatable.value.TextValue;
26+
import com.google.visualization.datasource.datatable.value.TimeOfDayValue;
2827
import com.google.visualization.datasource.datatable.value.Value;
28+
import com.google.visualization.datasource.datatable.value.ValueType;
2929

3030
import com.ibm.icu.util.GregorianCalendar;
3131
import com.ibm.icu.util.TimeZone;
@@ -88,7 +88,7 @@ public void setUp() throws Exception {
8888
row.addCell(new TableCell(false));
8989
row.addCell(new TableCell(new DateValue(2001, 10, 14)));
9090
row.addCell(new TableCell(new TimeOfDayValue(12, 11, 13, 14)));
91-
row.addCell(new TableCell(new DateTimeValue(2000, 10 ,1, 1, 10, 23, 432)));
91+
row.addCell(new TableCell(new DateTimeValue(2000, 10 , 1, 1, 10, 23, 432)));
9292
rows.add(row);
9393

9494
row = new TableRow();
@@ -106,7 +106,7 @@ public void setUp() throws Exception {
106106
row.addCell(new TableCell(true));
107107
row.addCell(new TableCell(new DateValue(2012, 2, 14)));
108108
row.addCell(new TableCell(new TimeOfDayValue(12, 11, 3, 14)));
109-
row.addCell(new TableCell(new DateTimeValue(2000, 1 ,1, 1, 10, 31, 4)));
109+
row.addCell(new TableCell(new DateTimeValue(2000, 1 , 1, 1, 10, 31, 4)));
110110
rows.add(row);
111111

112112
row = new TableRow();

src/test/java/com/google/visualization/datasource/datatable/TableCellTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414

1515
package com.google.visualization.datasource.datatable;
1616

17-
import com.ibm.icu.util.ULocale;
18-
import com.google.visualization.datasource.datatable.value.DateValue;
1917
import com.google.visualization.datasource.datatable.value.BooleanValue;
20-
import com.google.visualization.datasource.datatable.value.ValueType;
21-
import com.google.visualization.datasource.datatable.value.TextValue;
18+
import com.google.visualization.datasource.datatable.value.DateValue;
2219
import com.google.visualization.datasource.datatable.value.NumberValue;
20+
import com.google.visualization.datasource.datatable.value.TextValue;
21+
import com.google.visualization.datasource.datatable.value.ValueType;
22+
23+
import com.ibm.icu.util.ULocale;
2324

2425
import junit.framework.TestCase;
2526

@@ -130,6 +131,7 @@ public void testLocalizedComparator() {
130131
assertEquals(-1, rootComparator.compare(cell1, numberCell2));
131132
fail();
132133
} catch (RuntimeException e) {
134+
// Expected behavior.
133135
}
134136
}
135137

src/test/java/com/google/visualization/datasource/datatable/value/BooleanValueTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ public void testNullValueException() throws Exception {
5656
fail("Shouldn't get here - should have thrown a null value exception");
5757
} catch (NullValueException nve) {
5858
// This is the expected behavior.
59-
} catch (Throwable th) {
60-
fail("Shouldn't get here - should have thrown a null value exception");
6159
}
6260
}
6361

@@ -83,11 +81,13 @@ public void testComapreNullCases() {
8381
val.compareTo(null);
8482
fail();
8583
} catch (NullPointerException e) {
84+
// Expected behavior.
8685
}
8786
try {
8887
val.compareTo(new NumberValue(123));
8988
fail();
9089
} catch (ClassCastException e) {
90+
// Expected behavior.
9191
}
9292

9393
// Test NULL_VALUE cases.

src/test/java/com/google/visualization/datasource/datatable/value/DateTimeValueTest.java

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@ public void testConstructorOutOFRangeValuesMonth() {
4040
new DateTimeValue(2007, 13, 11, 23, 34, 56, 609);
4141
fail();
4242
} catch (IllegalArgumentException e) {
43+
// Expected behavior.
4344
}
4445
try {
4546
new DateTimeValue(2007, -1, 11, 23, 34, 56, 609);
4647
fail();
4748
} catch (IllegalArgumentException e) {
49+
// Expected behavior.
4850
}
4951
}
5052

@@ -54,11 +56,13 @@ public void testConstructorOutOfRangeValuesDayOfMonth() {
5456
new DateTimeValue(2007, 10, 32, 23, 34, 56, 609);
5557
fail();
5658
} catch (IllegalArgumentException e) {
59+
// Expected behavior.
5760
}
5861
try {
5962
new DateTimeValue(2007, 10, 0, 23, 34, 56, 609);
6063
fail();
6164
} catch (IllegalArgumentException e) {
65+
// Expected behavior.
6266
}
6367
}
6468

@@ -68,11 +72,13 @@ public void testConstructorOutOfRangeValuesHours() {
6872
new DateTimeValue(2007, 8, 20, 24, 34, 56, 609);
6973
fail();
7074
} catch (IllegalArgumentException e) {
75+
// Expected behavior.
7176
}
7277
try {
7378
new DateTimeValue(2007, 8, 20, -1, 34, 56, 609);
7479
fail();
7580
} catch (IllegalArgumentException e) {
81+
// Expected behavior.
7682
}
7783
}
7884

@@ -82,11 +88,13 @@ public void testConstructorOutOfRangeValuesMinutes() {
8288
new DateTimeValue(2007, 7, 11, 14, 62, 56, 609);
8389
fail();
8490
} catch (IllegalArgumentException e) {
91+
// Expected behavior.
8592
}
8693
try {
8794
new DateTimeValue(2007, 7, 11, 14, -1, 56, 609);
8895
fail();
8996
} catch (IllegalArgumentException e) {
97+
// Expected behavior.
9098
}
9199
}
92100

@@ -96,11 +104,13 @@ public void testConstructorOutOfRangeValuesSeconds() {
96104
new DateTimeValue(2007, 8, 11, 23, 34, 63, 609);
97105
fail();
98106
} catch (IllegalArgumentException e) {
107+
// Expected behavior.
99108
}
100109
try {
101110
new DateTimeValue(2007, 8, 11, 23, 34, -10, 609);
102111
fail();
103112
} catch (IllegalArgumentException e) {
113+
// Expected behavior.
104114
}
105115
}
106116

@@ -110,11 +120,13 @@ public void testConstructorOutOfRangeValuesMilliseconds() {
110120
new DateTimeValue(2007, 7, 11, 23, 34, 56, 1000);
111121
fail();
112122
} catch (IllegalArgumentException e) {
123+
// Expected behavior.
113124
}
114125
try {
115126
new DateTimeValue(2007, 7, 11, 23, 34, 56, -1);
116127
fail();
117128
} catch (IllegalArgumentException e) {
129+
// Expected behavior.
118130
}
119131
}
120132

@@ -125,18 +137,21 @@ public void testConstructorSpecialValuesOfDate() {
125137
new DateTimeValue(1990, 1, 30, 23, 11, 11, 100);
126138
fail();
127139
} catch (IllegalArgumentException e) {
140+
// Expected behavior.
128141
}
129142
try {
130143
// February doesn't have 29 days in 2007.
131144
new DateTimeValue(2007, 1, 29, 23, 10, 10, 200);
132145
fail();
133146
} catch (IllegalArgumentException e) {
147+
// Expected behavior.
134148
}
135149
try {
136150
// September doesn't have 31 days.
137151
new DateTimeValue(2007, 8, 31, 11, 5, 5, 5);
138152
fail();
139153
} catch (IllegalArgumentException e) {
154+
// Expected behavior.
140155
}
141156
}
142157

@@ -149,6 +164,7 @@ public void testJavaMonthConvention() {
149164
new DateTimeValue(1990, 12, 10, 1, 1, 1, 1);
150165
fail();
151166
} catch (IllegalArgumentException e) {
167+
// Expected behavior.
152168
}
153169
}
154170

@@ -245,16 +261,18 @@ public void testCompare(){
245261

246262
public void testCompareNullCases() {
247263
// Test null cases and classCast issues.
248-
DateTimeValue val = new DateTimeValue(10, 10, 10, 10, 10, 10 ,10);
264+
DateTimeValue val = new DateTimeValue(10, 10, 10, 10, 10, 10 , 10);
249265
try {
250266
val.compareTo(null);
251267
fail();
252268
} catch (NullPointerException e) {
269+
// Expected behavior.
253270
}
254271
try {
255272
val.compareTo(new NumberValue(123));
256273
fail();
257274
} catch (ClassCastException e) {
275+
// Expected behavior.
258276
}
259277

260278
// Test NULL_VALUE cases.
@@ -269,7 +287,7 @@ public void testCompareNullCases() {
269287
assertTrue(0 == val.compareTo(val));
270288

271289
// Test that compareTo can cast.
272-
Value val2 = new DateTimeValue(10, 10, 10, 15, 10, 10 ,10);
290+
Value val2 = new DateTimeValue(10, 10, 10, 15, 10, 10 , 10);
273291
assertTrue(0 > val.compareTo(val2));
274292
Value val3 = DateTimeValue.getNullValue();
275293
assertTrue(0 < val.compareTo(val3));
@@ -283,6 +301,7 @@ public void testGetCalendar() {
283301
val2.getCalendar();
284302
assertFalse(true);
285303
} catch (NullValueException e) {
304+
// Expected behavior.
286305
}
287306
}
288307

@@ -305,10 +324,10 @@ public void testHashCode() {
305324
}
306325

307326
public void testGetValueToFormat() {
308-
DateTimeValue val = new DateTimeValue(2020,3,12,2,31,12,111);
327+
DateTimeValue val = new DateTimeValue(2020, 3, 12, 2, 31, 12, 111);
309328
DateTimeValue valNull = DateTimeValue.getNullValue();
310329

311-
GregorianCalendar g = new GregorianCalendar(2020,3,12,2,31,12);
330+
GregorianCalendar g = new GregorianCalendar(2020, 3, 12, 2, 31, 12);
312331
g.set(GregorianCalendar.MILLISECOND, 111);
313332
g.setTimeZone(TimeZone.getTimeZone("GMT"));
314333

src/test/java/com/google/visualization/datasource/datatable/value/DateValueTest.java

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,20 @@ public void testConstructorOutOFRangeValuesDayOfMonth() {
4242
new DateValue(1990, 11, -1);
4343
fail();
4444
} catch (IllegalArgumentException e) {
45+
// Expected behavior.
4546
}
4647
try {
4748
DateValue value = new DateValue(1990, 11, 0);
4849
// Shouldn't be here.
4950
assertFalse(true);
5051
} catch (IllegalArgumentException e) {
52+
// Expected behavior.
5153
}
5254
try {
5355
new DateValue(1990, 11, 32);
5456
fail();
5557
} catch (IllegalArgumentException e) {
58+
// Expected behavior.
5659
}
5760
}
5861

@@ -65,11 +68,13 @@ public void testConstructorOutOFRangeValuesMonth() {
6568
new DateValue(1990, 13, 1);
6669
fail();
6770
} catch (IllegalArgumentException e) {
71+
// Expected behavior.
6872
}
6973
try {
7074
new DateValue(1990, -2, 1);
7175
fail();
7276
} catch (IllegalArgumentException e) {
77+
// Expected behavior.
7378
}
7479
}
7580

@@ -79,18 +84,21 @@ public void testConstructorSpecialDatesValues() {
7984
new DateValue(1990, 1, 30);
8085
fail();
8186
} catch (IllegalArgumentException e) {
87+
// Expected behavior.
8288
}
8389
try {
8490
// February doesn't have 29 days in 2007.
8591
new DateValue(2007, 1, 29);
8692
fail();
8793
} catch (IllegalArgumentException e) {
94+
// Expected behavior.
8895
}
8996
try {
9097
// September doesn't have 31 days.
9198
new DateValue(2007, 8, 31);
9299
fail();
93100
} catch (IllegalArgumentException e) {
101+
// Expected behavior.
94102
}
95103
}
96104

@@ -103,6 +111,7 @@ public void testJavaMonthConvention() {
103111
new DateValue(1990, 12, 10);
104112
fail();
105113
} catch (IllegalArgumentException e) {
114+
// Expected behavior.
106115
}
107116
}
108117

@@ -199,7 +208,7 @@ public void testGetYearNull(){
199208
val.getYear();
200209
assertFalse(true);
201210
} catch (NullValueException e) {
202-
211+
// Expected behavior.
203212
}
204213
}
205214

@@ -209,7 +218,7 @@ public void testGetMonthNull(){
209218
val.getMonth();
210219
assertFalse(true);
211220
} catch (NullValueException e) {
212-
221+
// Expected behavior.
213222
}
214223
}
215224

@@ -219,7 +228,7 @@ public void testGetDayOfMonthNull(){
219228
val.getDayOfMonth();
220229
assertFalse(true);
221230
} catch (NullValueException e) {
222-
231+
// Expected behavior.
223232
}
224233
}
225234

@@ -258,15 +267,17 @@ public void testCompare(){
258267
public void testCompareNullCases() {
259268
// Test null cases and classCast issues.
260269
DateValue val = new DateValue(1000, 10, 10);
261-
try{
270+
try {
262271
val.compareTo(null);
263272
fail();
264273
} catch (NullPointerException e) {
274+
// Expected behavior.
265275
}
266-
try{
276+
try {
267277
val.compareTo(new NumberValue(123));
268278
fail();
269279
} catch (ClassCastException e) {
280+
// Expected behavior.
270281
}
271282

272283
// Test NULL_VALUE cases.
@@ -288,11 +299,11 @@ public void testCompareNullCases() {
288299
}
289300

290301
public void testGetValueToFormat() {
291-
DateValue val = new DateValue(500,2,30);
302+
DateValue val = new DateValue(500, 2, 30);
292303
DateValue valNull = DateValue.getNullValue();
293304

294305
assertNull(valNull.getObjectToFormat());
295-
GregorianCalendar g = new GregorianCalendar(500,2,30);
306+
GregorianCalendar g = new GregorianCalendar(500, 2, 30);
296307
g.setTimeZone(TimeZone.getTimeZone("GMT"));
297308
assertEquals(g, val.getObjectToFormat());
298309

0 commit comments

Comments
 (0)