|
Re: how to configure assertions [message #897306 is a reply to message #897155] |
Mon, 23 July 2012 10:24  |
Eclipse User |
|
|
|
On 22.07.2012 19:30, Jonathan Camilleri wrote:
> I am using JUnit test for the first time, to test a sample class which should serve as a template for serialization, although it does not include all options.
>
> Do I need to configure Eclipse to enable assertions, or are they implicitly run?
>
> public void testEqualsDog() {
> if (d.equals(d)) {System.out.println("pass");}
> Dog d2 = new Dog(new Collar(3),3);
> assert (!(d.equals(d2)));
> fail("Not yet implemented");
> }
You are mixing concepts here: 'assert(...)' is a Java language concept
and I think in you want to assert the condition for the JUnit Framework,
in which case you have to use something like assertTrue(...) or
assertEquals(...).
Dani
|
|
|
Powered by
FUDForum. Page generated in 0.08811 seconds