[ 
https://issues.apache.org/jira/browse/CALCITE-2457?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16573781#comment-16573781
 ] 

Vladimir Sitnikov commented on CALCITE-2457:
--------------------------------------------

{quote}To add context information you can use named() method
{quote}
I'm sure we mean the same thing. Of course there are {{named}} and friends, 
however my point was Calcite tests often assert simple types (boolean, int, 
String), so Truth vs assertEquals does not matter much.

PS. I have tried to add Truth dependency to Calcite, and it seems to be 
incompatible.
{noformat}
java.lang.NoSuchMethodError: 
com.google.common.base.Strings.lenientFormat(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

        at com.google.common.truth.Subject.failWithRawMessage(Subject.java:1043)
        at com.google.common.truth.MapSubject.containsEntry(MapSubject.java:152)
{noformat}
{noformat}
    <dependency>
      <groupId>com.google.truth</groupId>
      <artifactId>truth</artifactId>
      <version>0.42</version>
      <scope>test</scope>
    </dependency>
{noformat}
It looks like {{Truth 0.42}} depends on {{Guava 25.1-android}}, and {{Calcite}} 
still uses Guava 19.

I have tried {{Truth 0.30 (released on 08-Sep-2016, the latest one that uses 
Guava 19)}}, and it produces the following:
{noformat}
java.lang.AssertionError: Not true that <{key1=val2}> contains entry 
<key2=val2>. However, the following keys are mapped to <val2>: [key1]

        at 
org.apache.calcite.test.SqlToRelConverterTest.testAliasList(SqlToRelConverterTest.java:101)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at 
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
        at 
com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
        at 
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
        at 
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.lang.AssertionError: Not true that <{key1=val2}> contains entry 
<key2=val2>. However, the following keys are mapped to <val2>: [key1]
        at com.google.common.truth.FailureStrategy.fail(FailureStrategy.java:28)
        at com.google.common.truth.FailureStrategy.fail(FailureStrategy.java:22)
        at com.google.common.truth.Subject.failWithRawMessage(Subject.java:423)
        at com.google.common.truth.MapSubject.containsEntry(MapSubject.java:127)
        ... 23 more

{noformat}

> Upgrade to JUnit 5
> ------------------
>
>                 Key: CALCITE-2457
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2457
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: Vladimir Sitnikov
>            Assignee: Julian Hyde
>            Priority: Major
>         Attachments: truth_assertmap.png
>
>
> JUnit 5 brings multiple useful features so tests are easier to read and write.
> Is there something that blocks upgrading to JUnit 5?
> By upgrade I mean bumping up the dependency version and creating new tests 
> with JUnit 5 features.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to