Skip to content

Commit 7f9ef7a

Browse files
committed
Warnings cleanup, add missing @test s
1 parent b3757dc commit 7f9ef7a

File tree

3 files changed

+74
-68
lines changed

3 files changed

+74
-68
lines changed

src/test/java/com/fasterxml/jackson/datatype/joda/depr/DateMidnightTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
import com.fasterxml.jackson.databind.SerializationFeature;
1616
import com.fasterxml.jackson.datatype.joda.JodaTestBase;
1717

18-
import static org.junit.jupiter.api.Assertions.*;
19-
2018
@SuppressWarnings("deprecation") // because DateMidnight deprecated by Joda
2119
public class DateMidnightTest extends JodaTestBase
2220
{
Lines changed: 62 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,78 @@
11
package com.fasterxml.jackson.datatype.joda.deser;
22

3+
import org.junit.jupiter.api.Test;
4+
5+
import org.joda.time.*;
6+
37
import com.fasterxml.jackson.databind.ObjectMapper;
48
import com.fasterxml.jackson.datatype.joda.JodaTestBase;
5-
import org.joda.time.Days;
6-
import org.joda.time.Hours;
7-
import org.joda.time.Minutes;
8-
import org.joda.time.Months;
9-
import org.joda.time.ReadablePeriod;
10-
import org.joda.time.Seconds;
11-
import org.joda.time.Weeks;
12-
import org.joda.time.Years;
13-
14-
import org.junit.jupiter.api.Test;
159

1610
import static org.junit.jupiter.api.Assertions.*;
1711

1812
public class ReadablePeriodDeserializerTest extends JodaTestBase
1913
{
14+
private final ObjectMapper MAPPER = jodaMapper();
2015

21-
public void testDeserializeSeconds() throws Exception
22-
{
23-
ObjectMapper objectMapper = jodaMapper();
24-
ReadablePeriod readablePeriod = objectMapper.readValue( "{\"fieldType\":{\"name\":\"seconds\"},\"seconds\":12,\"periodType\":{\"name\":\"Seconds\"}}", ReadablePeriod.class );
25-
assertNotNull( readablePeriod );
26-
assertEquals( Seconds.seconds( 12 ), readablePeriod );
27-
}
16+
@Test
17+
public void testDeserializeSeconds() throws Exception
18+
{
19+
ReadablePeriod readablePeriod = MAPPER.readValue(
20+
"{\"fieldType\":{\"name\":\"seconds\"},\"seconds\":12,\"periodType\":{\"name\":\"Seconds\"}}",
21+
ReadablePeriod.class );
22+
assertEquals( Seconds.seconds( 12 ), readablePeriod );
23+
}
2824

29-
public void testDeserializeMinutes() throws Exception
30-
{
31-
ObjectMapper objectMapper = jodaMapper();
32-
ReadablePeriod readablePeriod = objectMapper.readValue( "{\"fieldType\":{\"name\":\"minutes\"},\"minutes\":1,\"periodType\":{\"name\":\"Minutes\"}}", ReadablePeriod.class );
33-
assertNotNull( readablePeriod );
34-
assertEquals( Minutes.minutes( 1 ), readablePeriod );
35-
}
25+
@Test
26+
public void testDeserializeMinutes() throws Exception
27+
{
28+
ReadablePeriod readablePeriod = MAPPER.readValue(
29+
"{\"fieldType\":{\"name\":\"minutes\"},\"minutes\":1,\"periodType\":{\"name\":\"Minutes\"}}",
30+
ReadablePeriod.class );
31+
assertEquals( Minutes.minutes( 1 ), readablePeriod );
32+
}
3633

37-
public void testDeserializeHours() throws Exception
38-
{
39-
ObjectMapper objectMapper = jodaMapper();
40-
ReadablePeriod readablePeriod = objectMapper.readValue( "{\"fieldType\":{\"name\":\"hours\"},\"hours\":2,\"periodType\":{\"name\":\"Hours\"}}", ReadablePeriod.class );
41-
assertNotNull( readablePeriod );
42-
assertEquals( Hours.hours( 2 ), readablePeriod );
43-
}
34+
@Test
35+
public void testDeserializeHours() throws Exception
36+
{
37+
ReadablePeriod readablePeriod = MAPPER.readValue(
38+
"{\"fieldType\":{\"name\":\"hours\"},\"hours\":2,\"periodType\":{\"name\":\"Hours\"}}",
39+
ReadablePeriod.class );
40+
assertEquals( Hours.hours( 2 ), readablePeriod );
41+
}
4442

45-
public void testDeserializeDays() throws Exception
46-
{
47-
ObjectMapper objectMapper = jodaMapper();
48-
ReadablePeriod readablePeriod = objectMapper.readValue( "{\"fieldType\":{\"name\":\"days\"},\"days\":2,\"periodType\":{\"name\":\"Days\"}}", ReadablePeriod.class );
49-
assertNotNull( readablePeriod );
50-
assertEquals( Days.days( 2 ), readablePeriod );
51-
}
43+
@Test
44+
public void testDeserializeDays() throws Exception
45+
{
46+
ReadablePeriod readablePeriod = MAPPER.readValue(
47+
"{\"fieldType\":{\"name\":\"days\"},\"days\":2,\"periodType\":{\"name\":\"Days\"}}",
48+
ReadablePeriod.class );
49+
assertEquals( Days.days( 2 ), readablePeriod );
50+
}
5251

53-
public void testDeserializeWeeks() throws Exception
54-
{
55-
ObjectMapper objectMapper = jodaMapper();
56-
ReadablePeriod readablePeriod = objectMapper.readValue( "{\"fieldType\":{\"name\":\"weeks\"},\"weeks\":2,\"periodType\":{\"name\":\"Weeks\"}}", ReadablePeriod.class );
57-
assertNotNull( readablePeriod );
58-
assertEquals( Weeks.weeks( 2 ), readablePeriod );
59-
}
52+
@Test
53+
public void testDeserializeWeeks() throws Exception
54+
{
55+
ReadablePeriod readablePeriod = MAPPER.readValue(
56+
"{\"fieldType\":{\"name\":\"weeks\"},\"weeks\":2,\"periodType\":{\"name\":\"Weeks\"}}",
57+
ReadablePeriod.class );
58+
assertEquals( Weeks.weeks( 2 ), readablePeriod );
59+
}
6060

61-
public void testDeserializeMonths() throws Exception
62-
{
63-
ObjectMapper objectMapper = jodaMapper();
64-
ReadablePeriod readablePeriod = objectMapper.readValue( "{\"fieldType\":{\"name\":\"months\"},\"months\":2,\"periodType\":{\"name\":\"Months\"}}", ReadablePeriod.class );
65-
assertNotNull( readablePeriod );
66-
assertEquals( Months.months( 2 ), readablePeriod );
67-
}
61+
@Test
62+
public void testDeserializeMonths() throws Exception
63+
{
64+
ReadablePeriod readablePeriod = MAPPER.readValue(
65+
"{\"fieldType\":{\"name\":\"months\"},\"months\":2,\"periodType\":{\"name\":\"Months\"}}",
66+
ReadablePeriod.class );
67+
assertEquals( Months.months( 2 ), readablePeriod );
68+
}
6869

69-
public void testDeserializeYears() throws Exception
70-
{
71-
ObjectMapper objectMapper = jodaMapper();
72-
ReadablePeriod readablePeriod = objectMapper.readValue( "{\"fieldType\":{\"name\":\"years\"},\"years\":2,\"periodType\":{\"name\":\"Years\"}}", ReadablePeriod.class );
73-
assertNotNull( readablePeriod );
74-
assertEquals( Years.years( 2 ), readablePeriod );
75-
}
76-
}
70+
@Test
71+
public void testDeserializeYears() throws Exception
72+
{
73+
ReadablePeriod readablePeriod = MAPPER.readValue(
74+
"{\"fieldType\":{\"name\":\"years\"},\"years\":2,\"periodType\":{\"name\":\"Years\"}}",
75+
ReadablePeriod.class );
76+
assertEquals( Years.years( 2 ), readablePeriod );
77+
}
78+
}

src/test/java/com/fasterxml/jackson/datatype/joda/ser/JodaSerializationTest.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
package com.fasterxml.jackson.datatype.joda.ser;
22

3+
import java.io.IOException;
4+
import java.util.Random;
5+
6+
import org.joda.time.*;
7+
import org.joda.time.format.ISODateTimeFormat;
8+
39
import org.junit.jupiter.api.Test;
410

511
import com.fasterxml.jackson.annotation.JsonInclude;
@@ -10,11 +16,6 @@
1016
import com.fasterxml.jackson.databind.module.SimpleModule;
1117
import com.fasterxml.jackson.datatype.joda.JodaTestBase;
1218
import com.fasterxml.jackson.datatype.joda.cfg.JacksonJodaDateFormat;
13-
import org.joda.time.*;
14-
import org.joda.time.format.ISODateTimeFormat;
15-
16-
import java.io.IOException;
17-
import java.util.Random;
1819

1920
import static org.junit.jupiter.api.Assertions.*;
2021

@@ -269,46 +270,51 @@ public void testCustomYearMonthSer() throws Exception
269270
assertEquals(a2q("{'value':'2013/08'}"), json);
270271
}
271272

273+
@Test
272274
public void testHoursSer() throws Exception
273275
{
274276
Hours hours = Hours.hours(1);
275277
String json = MAPPER.writeValueAsString(hours);
276278
assertEquals("1", json);
277279
}
278280

281+
@Test
279282
public void testMinutesSer() throws Exception
280283
{
281284
Minutes minutes = Minutes.minutes(2);
282285
String json = MAPPER.writeValueAsString(minutes);
283286
assertEquals("2", json);
284287
}
285288

289+
@Test
286290
public void testSecondsSer() throws Exception
287291
{
288292
Seconds seconds = Seconds.seconds(3);
289293
String json = MAPPER.writeValueAsString(seconds);
290294
assertEquals("3", json);
291295
}
292296

297+
@Test
293298
public void testMonthsSer() throws Exception
294299
{
295300
Months months = Months.months(4);
296301
String json = MAPPER.writeValueAsString(months);
297302
assertEquals("4", json);
298303
}
299304

305+
@Test
300306
public void testYearsSer() throws Exception
301307
{
302308
Years years = Years.years(5);
303309
String json = MAPPER.writeValueAsString(years);
304310
assertEquals("5", json);
305311
}
306312

313+
@Test
307314
public void testWeeksSer() throws Exception
308315
{
309316
Weeks weeks = Weeks.weeks(6);
310317
String json = MAPPER.writeValueAsString(weeks);
311318
assertEquals("6", json);
312319
}
313-
314320
}

0 commit comments

Comments
 (0)