From 5dee452d2270fe172a85b1de817f0344aef8c1d2 Mon Sep 17 00:00:00 2001 From: Aaron Klish Date: Fri, 12 Mar 2021 15:02:37 -0600 Subject: [PATCH] Added IT test for numeric value prefix, postfix, infix, and in operators --- .../java/com/yahoo/elide/tests/FilterIT.java | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/elide-integration-tests/src/test/java/com/yahoo/elide/tests/FilterIT.java b/elide-integration-tests/src/test/java/com/yahoo/elide/tests/FilterIT.java index 2b9d1804df..f8d15b5134 100644 --- a/elide-integration-tests/src/test/java/com/yahoo/elide/tests/FilterIT.java +++ b/elide-integration-tests/src/test/java/com/yahoo/elide/tests/FilterIT.java @@ -1071,6 +1071,64 @@ void testPublishDateGreaterThanFilter() throws JsonProcessingException { } } + @Test + void testPublishDateEqualsFilter() throws JsonProcessingException { + /* Test Default */ + JsonNode result = getAsNode("/book?filter[book.publishDate][in]=0,1454638927412"); + + assertEquals(8, result.get("data").size()); + + /* Test RSQL Typed */ + result = getAsNode("/book?filter[book]=publishDate=in=(0,1454638927412)"); + + assertEquals(result.get("data").size(), 8); + } + + @Test + void testPublishDatePrefixFilter() throws JsonProcessingException { + /* Test Default */ + /* publish date = 1454638927412 */ + JsonNode result = getAsNode("/book?filter[book.publishDate][prefix]=1"); + + assertEquals(1, result.get("data").size()); + + /* Test RSQL Typed */ + /* publish date = 1454638927412 */ + result = getAsNode("/book?filter[book]=publishDate==1*"); + + assertEquals(result.get("data").size(), 1); + } + + @Test + void testPublishDateInfixFilter() throws JsonProcessingException { + /* Test Default */ + /* publish date = 1454638927412 */ + JsonNode result = getAsNode("/book?filter[book.publishDate][infix]=389"); + + assertEquals(1, result.get("data").size()); + + /* Test RSQL Typed */ + /* publish date = 1454638927412 */ + result = getAsNode("/book?filter[book]=publishDate==*389*"); + + assertEquals(result.get("data").size(), 1); + } + + @Test + void testPublishDatePostfixFilter() throws JsonProcessingException { + /* Test Default */ + /* publish date = 1454638927412 */ + JsonNode result = getAsNode("/book?filter[book.publishDate][postfix]=412"); + + assertEquals(1, result.get("data").size()); + + /* Test RSQL Typed */ + /* publish date = 1454638927412 */ + result = getAsNode("/book?filter[book]=publishDate==*412"); + + assertEquals(result.get("data").size(), 1); + } + @Test void testPublishDateGreaterThanFilterSubRecord() throws JsonProcessingException { long publishDate;