Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » how to configure assertions
how to configure assertions [message #897155] Sun, 22 July 2012 13:30 Go to next message
Jonathan Camilleri is currently offline Jonathan Camilleri
Messages: 50
Registered: July 2009
Member
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");
}
  • Attachment: Dog.rar
    (Size: 7.29KB, Downloaded 22 times)
Re: how to configure assertions [message #897306 is a reply to message #897155] Mon, 23 July 2012 10:24 Go to previous message
Dani Megert is currently offline Dani Megert
Messages: 3801
Registered: July 2009
Senior Member
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
Previous Topic:javax.servlet.http
Next Topic:Writing Files
Goto Forum:
  


Current Time: Fri Aug 01 08:02:53 EDT 2014

Powered by FUDForum. Page generated in 0.01551 seconds