You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by el...@apache.org on 2019/09/05 21:51:49 UTC

[phoenix] 03/03: PHOENIX-5460 SortOrderExpressionTest failure with JDK11

This is an automated email from the ASF dual-hosted git repository.

elserj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix.git

commit a3ff1707f299dd28ac7e43f90d68de1f58ca0342
Author: Istvan Toth <st...@stoty.hu>
AuthorDate: Mon Sep 2 12:45:40 2019 +0200

    PHOENIX-5460 SortOrderExpressionTest failure with JDK11
    
    Closes #577
    
    Signed-off-by: Josh Elser <el...@apache.org>
---
 .../apache/phoenix/expression/SortOrderExpressionTest.java    | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/phoenix-core/src/test/java/org/apache/phoenix/expression/SortOrderExpressionTest.java b/phoenix-core/src/test/java/org/apache/phoenix/expression/SortOrderExpressionTest.java
index e2ab684..c2850a9 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/expression/SortOrderExpressionTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/expression/SortOrderExpressionTest.java
@@ -146,7 +146,16 @@ public class SortOrderExpressionTest {
     @Test
     public void toChar() throws Exception {
         List<Expression> args = Lists.newArrayList(getInvertedLiteral(date(12, 11, 2001), PDate.INSTANCE));
-        evaluateAndAssertResult(new ToCharFunction(args, FunctionArgumentType.TEMPORAL, "", DateUtil.getDateFormatter("MM/dd/yy hh:mm a")), "12/11/01 12:00 AM");
+        // We may get AM or am depending on Java version, see JDK-8211985
+        // This is just a hack to accept any case, without completely rewriting the test logic
+        Object caseInsensitiveExpected = new Object() {
+            @Override
+            public boolean equals(Object other) {
+                return (other instanceof String) && "12/11/01 12:00 AM".equalsIgnoreCase((String) other);
+            }
+        };
+        evaluateAndAssertResult(new ToCharFunction(args, FunctionArgumentType.TEMPORAL, "", DateUtil.getDateFormatter("MM/dd/yy hh:mm a")),
+            caseInsensitiveExpected);
     }
     
     @Test