Skip to content

Commit 0a635f5

Browse files
committed
pass tests
1 parent 1b29a1b commit 0a635f5

File tree

2 files changed

+57
-7
lines changed

2 files changed

+57
-7
lines changed

TODO.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11

22
## Task list
33

4-
54
Ordered roughly in priority:
65

7-
- Pass tests
8-
- Add more real world scenarios (particularly nested objects)
6+
- Add more real world payloads
97
- Symbol pool for class names
8+
- General cleanup of weird/disgusting code areas
109

1110
- Make website tool prettier
1211
- Throttle website tool/prepare for HN
12+
- Docs + writeup
1313

14-
- General cleanup of weird/disgusting code areas
1514
- Unit tests for individual methods (once codebase a bit less volatile)
16-
- Docs + writeup
1715

1816
## Rough architecture
1917

core/src/test/kotlin/com/fractalwrench/json2kotlin/gson/PlaqueGsonSerialisationTest.kt

+54-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,62 @@ class PlaqueGsonSerialisationTest : AbstractSerialisationTest() {
1414
override fun testGsonSerialisation() {
1515
val gson = Gson().fromJson(json, PlaqueExample::class.java)
1616
Assert.assertNotNull(gson)
17+
Assert.assertNotNull(gson.meta)
18+
Assert.assertNotNull(gson.data)
1719

20+
with(gson.meta.view) { // only serialise some, otherwise we'll be here all day...
21+
Assert.assertEquals("bsf5-k2w2", id)
22+
Assert.assertEquals("Open Plaques", name)
23+
Assert.assertEquals("OpenPlaques", attribution)
24+
Assert.assertEquals("http://openplaques.org/places/gb/areas/bath", attributionLink)
25+
Assert.assertEquals(0, averageRating.toInt())
26+
Assert.assertEquals("Heritage", category)
27+
Assert.assertEquals(1412965968, createdAt.toLong())
28+
Assert.assertEquals("A list of the commemorative plaques found around Bath, as recorded in the Open Plaques database. The dataset contains information on the location, title, inscription, and subjects for each plaque, along with a pointer to a JSON document that provides more detail about each plaque and its subjects.", description)
29+
Assert.assertEquals("table", displayType)
30+
Assert.assertEquals(76, downloadCount.toInt())
31+
Assert.assertEquals(false, hideFromCatalog)
32+
Assert.assertEquals(false, hideFromDataJson)
33+
Assert.assertEquals("fileId:1Bbr1-uyvhayzyY7QJjnXt1D7wOeYinuleYg8s9ba9Q", iconUrl)
34+
Assert.assertEquals(1412966520, indexUpdatedAt.toLong())
35+
Assert.assertEquals("PUBLIC_DOMAIN", licenseId)
36+
Assert.assertEquals(false, newBackend)
37+
Assert.assertEquals(0, numberOfComments.toInt())
38+
Assert.assertEquals(17070, oid.toInt())
39+
Assert.assertEquals("official", provenance)
40+
Assert.assertEquals(false, publicationAppendEnabled)
41+
Assert.assertEquals(1412966522, publicationDate.toLong())
42+
Assert.assertEquals(12018, publicationGroup.toInt())
43+
Assert.assertEquals("published", publicationStage)
44+
Assert.assertEquals("", rowClass)
45+
Assert.assertEquals(193351, rowIdentifierColumnId.toInt())
46+
Assert.assertEquals(1412965973, rowsUpdatedAt.toLong())
47+
Assert.assertEquals("22aw-9kr4", rowsUpdatedBy)
48+
Assert.assertEquals(12018, tableId.toInt())
49+
Assert.assertEquals(0, totalTimesRated.toInt())
50+
Assert.assertEquals(331, viewCount.toInt())
51+
Assert.assertEquals(1412966522, viewLastModified.toLong())
52+
Assert.assertEquals("tabular", viewType)
1853

54+
Assert.assertEquals(1, grants.size)
55+
Assert.assertEquals(false, grants[0].inherited)
56+
Assert.assertEquals("viewer", grants[0].type)
57+
Assert.assertEquals("public", grants[0].flags[0])
1958

20-
Assert.fail()
21-
}
59+
Assert.assertEquals("Public Domain", license.name)
60+
61+
Assert.assertEquals("0", metadata.rdfSubject)
62+
Assert.assertEquals("", metadata.rdfClass)
63+
Assert.assertEquals("id", metadata.rowIdentifier)
64+
Assert.assertEquals("On change", metadata.custom_fields.Publication.Update_Frequency)
65+
Assert.assertEquals("http://openplaques.org/about/data", metadata.custom_fields.Additional_Licence_Detail.Re_user_Guidelines)
66+
Assert.assertEquals("Open Data Commons Public Domain Dedication (PDDL)", metadata.custom_fields.Additional_Licence_Detail.Additional_Licence_Information)
67+
Assert.assertEquals("http://opendatacommons.org/licenses/pddl/", metadata.custom_fields.Additional_Licence_Detail.Licence_URL)
68+
Assert.assertEquals(true, metadata.renderTypeConfig.visible.table)
2269

70+
Assert.assertEquals(3, metadata.availableDisplayTypes.size)
71+
Assert.assertEquals("fatrow", metadata.availableDisplayTypes[1])
72+
73+
}
74+
}
2375
}

0 commit comments

Comments
 (0)