Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6bd059c

Browse files
java-team-github-botJavac Team
authored andcommitted
Automatic code cleanup.
PiperOrigin-RevId: 734747367
1 parent 73170c3 commit 6bd059c

File tree

7 files changed

+91
-77
lines changed

7 files changed

+91
-77
lines changed

jdk11/src/libcore/luni/src/test/java/libcore/java/time/ZoneOffsetTest.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@
1515
*/
1616
package libcore.java.time;
1717

18-
import org.junit.Test;
19-
import org.junit.runner.RunWith;
20-
import org.junit.runners.JUnit4;
18+
import static org.junit.Assert.assertEquals;
19+
import static org.junit.Assert.assertThrows;
20+
import static org.junit.Assert.fail;
21+
2122
import java.time.ZoneOffset;
2223
import java.time.temporal.ChronoField;
2324
import java.time.temporal.UnsupportedTemporalTypeException;
24-
25-
import static org.junit.Assert.assertEquals;
26-
import static org.junit.Assert.fail;
25+
import org.junit.Test;
26+
import org.junit.runner.RunWith;
27+
import org.junit.runners.JUnit4;
2728

2829
/**
2930
* Additional tests for {@link ZoneOffset}.
@@ -51,9 +52,9 @@ public void test_range() {
5152
OFFSET_P1.range(ChronoField.OFFSET_SECONDS));
5253
}
5354

54-
@Test(expected = NullPointerException.class)
55-
public void test_range_null() {
56-
OFFSET_P1.range(null);
55+
@Test
56+
public void test_range_null() {
57+
assertThrows(NullPointerException.class, () -> OFFSET_P1.range(null));
5758
}
5859

5960
@Test

jdk11/src/libcore/luni/src/test/java/libcore/java/time/ZonedDateTimeTest.java

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,17 @@
1515
*/
1616
package libcore.java.time;
1717

18-
import org.junit.Test;
19-
import org.junit.runner.RunWith;
20-
import org.junit.runners.JUnit4;
21-
import java.time.LocalDate;
18+
import static org.junit.Assert.assertEquals;
19+
import static org.junit.Assert.assertThrows;
20+
2221
import java.time.LocalDateTime;
23-
import java.time.LocalTime;
2422
import java.time.Month;
2523
import java.time.ZoneId;
2624
import java.time.ZoneOffset;
2725
import java.time.ZonedDateTime;
28-
29-
import static org.junit.Assert.assertEquals;
30-
26+
import org.junit.Test;
27+
import org.junit.runner.RunWith;
28+
import org.junit.runners.JUnit4;
3129

3230
/**
3331
* Additional tets for {@link ZonedDateTime}.
@@ -117,19 +115,22 @@ private static void checkOfInstant(LocalDateTime localDateTime, ZoneOffset offse
117115
}
118116
}
119117

120-
@Test(expected = NullPointerException.class)
121-
public void test_ofInstant_localDateTime_null() {
122-
ZonedDateTime.ofInstant(null, OFFSET_P1, ZONE_VIENNA);
118+
@Test
119+
public void test_ofInstant_localDateTime_null() {
120+
assertThrows(
121+
NullPointerException.class, () -> ZonedDateTime.ofInstant(null, OFFSET_P1, ZONE_VIENNA));
123122
}
124123

125-
@Test(expected = NullPointerException.class)
126-
public void test_ofInstant_offset_null() {
127-
ZonedDateTime.ofInstant(LDT_P1, null, ZONE_VIENNA);
124+
@Test
125+
public void test_ofInstant_offset_null() {
126+
assertThrows(
127+
NullPointerException.class, () -> ZonedDateTime.ofInstant(LDT_P1, null, ZONE_VIENNA));
128128
}
129129

130-
@Test(expected = NullPointerException.class)
131-
public void test_ofInstant_zone_null() {
132-
ZonedDateTime.ofInstant(LDT_P1, OFFSET_P1, null);
130+
@Test
131+
public void test_ofInstant_zone_null() {
132+
assertThrows(
133+
NullPointerException.class, () -> ZonedDateTime.ofInstant(LDT_P1, OFFSET_P1, null));
133134
}
134135

135136
@Test
@@ -180,13 +181,14 @@ private static void checkOfLocal(LocalDateTime localDateTime, ZoneId zone,
180181
assertEquals("localDateTime" + message, expectedDateTime, zonedDateTime.toLocalDateTime());
181182
}
182183

183-
@Test(expected = NullPointerException.class)
184-
public void test_ofLocal_localDateTime_null() {
185-
ZonedDateTime.ofLocal(null, ZONE_VIENNA, OFFSET_P1);
184+
@Test
185+
public void test_ofLocal_localDateTime_null() {
186+
assertThrows(
187+
NullPointerException.class, () -> ZonedDateTime.ofLocal(null, ZONE_VIENNA, OFFSET_P1));
186188
}
187189

188-
@Test(expected = NullPointerException.class)
189-
public void test_ofLocal_zone_null() {
190-
ZonedDateTime.ofLocal(LDT_P1, null, OFFSET_P1);
190+
@Test
191+
public void test_ofLocal_zone_null() {
192+
assertThrows(NullPointerException.class, () -> ZonedDateTime.ofLocal(LDT_P1, null, OFFSET_P1));
191193
}
192194
}

jdk11/src/libcore/luni/src/test/java/libcore/java/time/chrono/ChronologyTest.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
*/
1616
package libcore.java.time.chrono;
1717

18-
import org.junit.Test;
19-
import org.junit.runner.RunWith;
20-
import org.junit.runners.JUnit4;
18+
import static org.junit.Assert.assertEquals;
19+
import static org.junit.Assert.assertThrows;
20+
2121
import java.time.chrono.AbstractChronology;
2222
import java.time.chrono.ChronoLocalDate;
2323
import java.time.chrono.Chronology;
@@ -29,8 +29,9 @@
2929
import java.util.LinkedHashSet;
3030
import java.util.List;
3131
import java.util.Set;
32-
33-
import static org.junit.Assert.assertEquals;
32+
import org.junit.Test;
33+
import org.junit.runner.RunWith;
34+
import org.junit.runners.JUnit4;
3435

3536
/**
3637
* Additional tests for {@link Chronology}.
@@ -66,9 +67,9 @@ private static void assertComparesAccordingToId(Chronology c1, Chronology c2) {
6667
chronologyResult == 0, c1.equals(c2));
6768
}
6869

69-
@Test(expected = NullPointerException.class)
70-
public void test_compareTo_null() {
71-
IsoChronology.INSTANCE.compareTo(null);
70+
@Test
71+
public void test_compareTo_null() {
72+
assertThrows(NullPointerException.class, () -> IsoChronology.INSTANCE.compareTo(null));
7273
}
7374

7475
/** Fake chronology that supports only returning an id and a type. */

jdk11/src/libcore/luni/src/test/java/libcore/java/time/chrono/HijrahChronologyTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717

1818
import static org.junit.Assert.assertEquals;
1919
import static org.junit.Assert.assertSame;
20-
21-
import org.junit.Test;
22-
import org.junit.runner.RunWith;
23-
import org.junit.runners.JUnit4;
20+
import static org.junit.Assert.assertThrows;
2421

2522
import java.time.chrono.HijrahChronology;
2623
import java.time.chrono.HijrahDate;
2724
import java.time.chrono.HijrahEra;
2825
import java.time.temporal.ChronoField;
26+
import org.junit.Test;
27+
import org.junit.runner.RunWith;
28+
import org.junit.runners.JUnit4;
2929

3030
/**
3131
* Additional tests for {@link HijrahDate}.
@@ -64,9 +64,9 @@ public void test_HijrahDate_withVariant_same() {
6464
assertSame(date1, date2);
6565
}
6666

67-
@Test(expected = NullPointerException.class)
68-
public void test_HijrahDate_withVariant_null() {
69-
HijrahDate.now().withVariant(null);
67+
@Test
68+
public void test_HijrahDate_withVariant_null() {
69+
assertThrows(NullPointerException.class, () -> HijrahDate.now().withVariant(null));
7070
}
7171

7272
@Test

jdk11/src/libcore/luni/src/test/java/libcore/java/time/chrono/IsoChronologyTest.java

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
*/
1616
package libcore.java.time.chrono;
1717

18-
import org.junit.Test;
19-
import org.junit.runner.RunWith;
20-
import org.junit.runners.JUnit4;
18+
import static org.junit.Assert.assertEquals;
19+
import static org.junit.Assert.assertThrows;
20+
import static org.junit.Assert.fail;
21+
2122
import java.time.DateTimeException;
2223
import java.time.Instant;
2324
import java.time.LocalDate;
@@ -29,9 +30,9 @@
2930
import java.time.chrono.IsoChronology;
3031
import java.time.chrono.IsoEra;
3132
import java.time.temporal.ChronoField;
32-
33-
import static org.junit.Assert.assertEquals;
34-
import static org.junit.Assert.fail;
33+
import org.junit.Test;
34+
import org.junit.runner.RunWith;
35+
import org.junit.runners.JUnit4;
3536

3637
/**
3738
* Additional tests for {@link IsoChronology}.
@@ -112,13 +113,17 @@ public void test_zonedDateTime() {
112113
assertEquals(ZoneOffset.ofHours(1), result.getOffset());
113114
}
114115

115-
@Test(expected = NullPointerException.class)
116-
public void test_zonedDateTime_nullInstant() {
117-
IsoChronology.INSTANCE.zonedDateTime(null, ZoneOffset.UTC);
116+
@Test
117+
public void test_zonedDateTime_nullInstant() {
118+
assertThrows(
119+
NullPointerException.class,
120+
() -> IsoChronology.INSTANCE.zonedDateTime(null, ZoneOffset.UTC));
118121
}
119122

120-
@Test(expected = NullPointerException.class)
121-
public void test_zonedDateTime_nullZone() {
122-
IsoChronology.INSTANCE.zonedDateTime(Instant.EPOCH, null);
123+
@Test
124+
public void test_zonedDateTime_nullZone() {
125+
assertThrows(
126+
NullPointerException.class,
127+
() -> IsoChronology.INSTANCE.zonedDateTime(Instant.EPOCH, null));
123128
}
124129
}

jdk11/src/libcore/luni/src/test/java/libcore/java/time/chrono/JapaneseChronologyTest.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
*/
1616
package libcore.java.time.chrono;
1717

18-
import static org.junit.Assert.assertEquals;
19-
import static org.junit.Assert.assertSame;
20-
2118
import static java.time.chrono.JapaneseEra.REIWA;
2219
import static java.time.chrono.JapaneseEra.SHOWA;
20+
import static org.junit.Assert.assertEquals;
21+
import static org.junit.Assert.assertSame;
22+
import static org.junit.Assert.assertThrows;
2323

2424
import java.time.Instant;
2525
import java.time.LocalDate;
@@ -60,14 +60,18 @@ public void test_zonedDateTime() {
6060
assertEquals(ZoneOffset.ofHours(1), result.getOffset());
6161
}
6262

63-
@Test(expected = NullPointerException.class)
64-
public void test_zonedDateTime_nullInstant() {
65-
JapaneseChronology.INSTANCE.zonedDateTime(null, ZoneOffset.UTC);
63+
@Test
64+
public void test_zonedDateTime_nullInstant() {
65+
assertThrows(
66+
NullPointerException.class,
67+
() -> JapaneseChronology.INSTANCE.zonedDateTime(null, ZoneOffset.UTC));
6668
}
6769

68-
@Test(expected = NullPointerException.class)
69-
public void test_zonedDateTime_nullZone() {
70-
JapaneseChronology.INSTANCE.zonedDateTime(Instant.EPOCH, null);
70+
@Test
71+
public void test_zonedDateTime_nullZone() {
72+
assertThrows(
73+
NullPointerException.class,
74+
() -> JapaneseChronology.INSTANCE.zonedDateTime(Instant.EPOCH, null));
7175
}
7276

7377
@Test

jdk11/src/libcore/luni/src/test/java/libcore/java/time/zone/ZoneRulesTest.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,20 @@
1515
*/
1616
package libcore.java.time.zone;
1717

18-
import org.junit.Test;
19-
import org.junit.runner.RunWith;
20-
import org.junit.runners.JUnit4;
18+
import static org.junit.Assert.assertEquals;
19+
import static org.junit.Assert.assertNull;
20+
import static org.junit.Assert.assertThrows;
21+
2122
import java.time.Duration;
2223
import java.time.Instant;
2324
import java.time.LocalDateTime;
2425
import java.time.Month;
2526
import java.time.ZoneOffset;
2627
import java.time.zone.ZoneRules;
2728
import java.util.Collections;
28-
29-
import static org.junit.Assert.assertEquals;
30-
import static org.junit.Assert.assertNull;
29+
import org.junit.Test;
30+
import org.junit.runner.RunWith;
31+
import org.junit.runners.JUnit4;
3132

3233
/**
3334
* Additional tests for {@link ZoneRules}.
@@ -66,8 +67,8 @@ public void test_of_ZoneOffset() {
6667
}
6768
}
6869

69-
@Test(expected = NullPointerException.class)
70-
public void test_of_ZoneOffset_null() {
71-
ZoneRules.of(null);
70+
@Test
71+
public void test_of_ZoneOffset_null() {
72+
assertThrows(NullPointerException.class, () -> ZoneRules.of(null));
7273
}
7374
}

0 commit comments

Comments
 (0)