code snippets from someone studying the art of computer science, a public notebook.

junit - custom error messages

Date: 2011-11-10 18:39 tags: testing java

TypeSafeMatcher<Double> match = new TypeSafeMatcher<Double>() {

    @Override
    public void describeTo(Description arg0) {
        // TODO Auto-generated method stub
        
    }

    @Override
    public boolean matchesSafely(Double arg0) {
        
        System.out.println( arg0 );
        
        //test that something is <=100
        return !( arg0 > 100 );
    }
};
    
Assert.assertThat( "Oh no it's > 100!", 100.34, match );

comments:

----

Add a comment:

Name:

Comment:

copyright 2012. font by ΒΆ