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

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

{quote} assertThat(Collections.singletonMap("key1", 
"val2")).containsEntry("key2", "val2");{quote}
Here's how it looks like in IDEA (no "show diff" link): 
!truth_assertmap.png|thumbnail! 

Note: you still have to describe WHY do you assert the contents of the map. In 
other words, test failure like "this map is supposed to contain that entry" 
provides no clue on what the map is and why it should contain entries.

In Calcite, tests are often created around some prerequisite, so it ends up 
with something like "{{source object}} should somehow produce a complex 
{{result object}}, and asserts verify the result object"
However, error message should include {{source object}} as well, so the error 
message is clear.
For instance: "Logical plan for sql SELECT * FROM JIRA does not match:   
expected aaa got bbb". I don't see how Truth solves that automagically.

Assert code would look like
{code:java}
assertEquals("Logical plan for sql" + sql + " does not match", expectedPlan, 
actualPlan);
{code}
Where Truth/AssertJ would get {{sql}} object from?


> 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