Skip to content

Commit 3f933e8

Browse files
committed
Minor test refactoring
1 parent 9e64875 commit 3f933e8

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

jr-objects/src/test/java/com/fasterxml/jackson/jr/ob/WriteSimpleTest.java

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
public class WriteSimpleTest extends TestBase
1515
{
16-
final static class POJO {
16+
static class POJO {
1717
public int value = 3;
1818

1919
public POJO() { }
@@ -22,12 +22,20 @@ public POJO() { }
2222

2323
enum ABC { A, B, C; }
2424

25-
final static class Address {
25+
static class Address {
2626
public String name;
2727

2828
public Address(String n) { name = n; }
2929
}
30-
30+
31+
static class PathWrapper {
32+
public Path path;
33+
34+
public PathWrapper(Path p) {
35+
path = p;
36+
}
37+
}
38+
3139
/*
3240
/**********************************************************************
3341
/* Test methdods
@@ -102,18 +110,30 @@ public void testNest() throws Exception
102110
JSON.std.asString(stuff));
103111
}
104112

105-
public void testKnownSimpleTypes() throws Exception
113+
public void testKnownSimpleTypeURI() throws Exception
106114
{
107115
final String URL_STR = "http://fasterxml.com";
108116
final URI uri = new URI(URL_STR);
109117
assertEquals(q(URL_STR), JSON.std.asString(uri));
118+
}
119+
120+
public void testKnownSimpleTypeFile() throws Exception
121+
{
110122
final String PATH = "/foo/bar.txt";
111123
assertEquals(q(PATH),
112124
JSON.std.asString(new File(PATH)));
125+
}
113126

127+
public void testKnownSimpleTypePath() throws Exception
128+
{
114129
Path p = Paths.get(new URI("file:///foo/bar.txt"));
115130
assertEquals(q("file:///foo/bar.txt"), JSON.std.asString(p));
116131

132+
assertEquals(a2q("{'path':'file:///foo/bar.txt'}"), JSON.std.asString(new PathWrapper(p)));
133+
}
134+
135+
public void testSimpleEnumTypes() throws Exception
136+
{
117137
assertEquals(q("B"), JSON.std.asString(ABC.B));
118138
assertEquals("1", JSON.std.with(Feature.WRITE_ENUMS_USING_INDEX).asString(ABC.B));
119139
}

0 commit comments

Comments
 (0)