Repository: incubator-tamaya-extensions Updated Branches: refs/heads/master d0fffd689 -> cbcbdf1ed
TAMAYA-291: Raise test coverage Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/cbcbdf1e Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/cbcbdf1e Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/cbcbdf1e Branch: refs/heads/master Commit: cbcbdf1ed9572e775d6d9437553244eb3b1a7e76 Parents: d0fffd6 Author: Phil Ottlinger <[email protected]> Authored: Sun Oct 22 23:04:12 2017 +0200 Committer: Phil Ottlinger <[email protected]> Committed: Sun Oct 22 23:04:12 2017 +0200 ---------------------------------------------------------------------- .../test/java/org/apache/tamaya/json/JSONVisitorTest.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/cbcbdf1e/modules/formats/json/src/test/java/org/apache/tamaya/json/JSONVisitorTest.java ---------------------------------------------------------------------- diff --git a/modules/formats/json/src/test/java/org/apache/tamaya/json/JSONVisitorTest.java b/modules/formats/json/src/test/java/org/apache/tamaya/json/JSONVisitorTest.java index c9c9f7f..e733cf4 100644 --- a/modules/formats/json/src/test/java/org/apache/tamaya/json/JSONVisitorTest.java +++ b/modules/formats/json/src/test/java/org/apache/tamaya/json/JSONVisitorTest.java @@ -33,13 +33,14 @@ import org.junit.Test; public class JSONVisitorTest { @Test - public void ensureJSONisParsedProperlyWithDifferentValueTypes() { + public void ensureJSONisParsedProperlyWithDifferentValueTypesFilteringOutEmptyValues() { JsonObject startNode = Json.createObjectBuilder().// add("key.sub", "value").// add("anotherKey", true).// add("notAnotherKey", false).// add("number", 4711).// add("null", JsonValue.NULL).// + add("empty", JsonValue.EMPTY_JSON_OBJECT).// build(); Map<String, String> targetStore = new HashMap<>(); JSONVisitor visitor = new JSONVisitor(startNode, targetStore); @@ -48,6 +49,11 @@ public class JSONVisitorTest { visitor.run(); assertThat(targetStore).hasSize(5); + assertThat(targetStore).containsKeys("key.sub", "anotherKey", "notAnotherKey", "number", "null"); + assertThat(targetStore).containsEntry("key.sub", "value"); + assertThat(targetStore).containsEntry("null", null); + assertThat(targetStore).containsEntry("anotherKey", "true"); + assertThat(targetStore).doesNotContainKey("empty"); } @Test @@ -72,5 +78,5 @@ public class JSONVisitorTest { assertThat(visitor).isNotNull(); visitor.run(); } - + }
