From d4d97a6ab8c69ca6fd779eac63fa1da5a68afa6d Mon Sep 17 00:00:00 2001 From: Jonathan Haber Date: Mon, 24 Jan 2022 18:51:50 -0500 Subject: [PATCH] Test is now passing (#740) --- .../core/filter/BasicParserFilteringTest.java | 22 ++++++++++++ .../filter/BasicParserFilteringTest.java | 36 ------------------- 2 files changed, 22 insertions(+), 36 deletions(-) delete mode 100644 src/test/java/com/fasterxml/jackson/failing/filter/BasicParserFilteringTest.java diff --git a/src/test/java/com/fasterxml/jackson/core/filter/BasicParserFilteringTest.java b/src/test/java/com/fasterxml/jackson/core/filter/BasicParserFilteringTest.java index ebb5abe4d0..97f6c77283 100644 --- a/src/test/java/com/fasterxml/jackson/core/filter/BasicParserFilteringTest.java +++ b/src/test/java/com/fasterxml/jackson/core/filter/BasicParserFilteringTest.java @@ -79,6 +79,14 @@ public TokenFilter includeElement(int index) { protected boolean _includeScalar() { return false; } } + static class NoArraysFilter extends TokenFilter + { + @Override + public TokenFilter filterStartArray() { + return null; + } + } + static class NoObjectsFilter extends TokenFilter { @Override @@ -412,6 +420,20 @@ public void testNoMatchFiltering6() throws Exception assertEquals(0, p.getMatchCount()); } + public void testValueOmitsFieldName1() throws Exception + { + String jsonString = aposToQuotes("{'a':123,'array':[1,2]}"); + JsonParser p0 = JSON_F.createParser(jsonString); + FilteringParserDelegate p = new FilteringParserDelegate(p0, + new NoArraysFilter(), + Inclusion.INCLUDE_NON_NULL, + true // multipleMatches + ); + String result = readAndWrite(JSON_F, p); + assertEquals(aposToQuotes("{'a':123}"), result); + assertEquals(1, p.getMatchCount()); + } + public void testValueOmitsFieldName2() throws Exception { String jsonString = aposToQuotes("['a',{'value0':3,'b':{'value':4}},123]"); diff --git a/src/test/java/com/fasterxml/jackson/failing/filter/BasicParserFilteringTest.java b/src/test/java/com/fasterxml/jackson/failing/filter/BasicParserFilteringTest.java deleted file mode 100644 index c47a23d8b7..0000000000 --- a/src/test/java/com/fasterxml/jackson/failing/filter/BasicParserFilteringTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.fasterxml.jackson.failing.filter; - -import com.fasterxml.jackson.core.BaseTest; -import com.fasterxml.jackson.core.JsonFactory; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.filter.FilteringParserDelegate; -import com.fasterxml.jackson.core.filter.TokenFilter; -import com.fasterxml.jackson.core.filter.TokenFilter.Inclusion; - -public class BasicParserFilteringTest extends BaseTest { - - private final JsonFactory JSON_F = new JsonFactory(); - - static class NoArraysFilter extends TokenFilter - { - @Override - public TokenFilter filterStartArray() { - return null; - } - } - - // for [core#649] - public void testValueOmitsFieldName1() throws Exception - { - String jsonString = aposToQuotes("{'a':123,'array':[1,2]}"); - JsonParser p0 = JSON_F.createParser(jsonString); - FilteringParserDelegate p = new FilteringParserDelegate(p0, - new NoArraysFilter(), - Inclusion.INCLUDE_NON_NULL, - true // multipleMatches - ); - String result = readAndWrite(JSON_F, p); - assertEquals(aposToQuotes("{'a':123}"), result); - assertEquals(0, p.getMatchCount()); - } -}