[ 
https://issues.jboss.org/browse/RF-13130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12796848#comment-12796848
 ] 

Lukáš Fryč edited comment on RF-13130 at 8/14/13 12:23 PM:
-----------------------------------------------------------

Hamcrest-style API provides more readable tests, but more importantly readable 
results - compare:

{code}
Assert.assertTrue(list.isEmpty());
{code}

Fails with: {{AssertionError}}

{code}
Assert.assertTrue("list is empty", list.isEmpty());
{code}

Fails with: {{list is empty}}

{code}
Assert.assertThat(list, is(empty());
{code}

Fails with: {{The 'list' is expected to be empty, but it was: ...}}

----

The second option is refactoring proof, as it does not have to bear any message 
in order to understand what assertion has been made.

Both APIs are part of JUnit, since JUnit transitionally depends on Hamcrest 
Core, however in Hamcrest Core are just simple matchers, e.g. it misses:

{code}
Assert.assertThat(someString, containsString("foo"));
{code}
                
      was (Author: lfryc):
    Hamcrest-style API provides more readable tests, but more importantly 
results - compare:

{code}
Assert.assertTrue(list.isEmpty());
{code}

Fails with: {{AssertionError}}

{code}
Assert.assertTrue("list is empty", list.isEmpty());
{code}

Fails with: {{list is empty}}

{code}
Assert.assertThat(list, is(empty());
{code}

Fails with: {{The 'list' is expected to be empty, but it was: ...}}

----

The second option is refactoring proof, as it does not have to bear any message 
in order to understand what assertion has been made.

Both APIs are part of JUnit, since JUnit transitionally depends on Hamcrest 
Core, however in Hamcrest Core are just simple matchers, e.g. it misses:

{code}
Assert.assertThat(someString, containsString("foo"));
{code}
                  
> Add Hamcrest for BDD-style assertions
> -------------------------------------
>
>                 Key: RF-13130
>                 URL: https://issues.jboss.org/browse/RF-13130
>             Project: RichFaces
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>          Components: tests - unit
>            Reporter: Lukáš Fryč
>            Assignee: Lukáš Fryč
>             Fix For: 5.0.0.Alpha2
>
>
> https://code.google.com/p/hamcrest/

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

_______________________________________________
richfaces-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/richfaces-issues

Reply via email to