Skip to main content


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 17:30 Go to next message
Jonathan Camilleri is currently offline Jonathan CamilleriFriend
Messages: 91
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 114 times)
Re: how to configure assertions [message #897306 is a reply to message #897155] Mon, 23 July 2012 14:24 Go to previous message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
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 Apr 19 22:18:04 GMT 2024

Powered by FUDForum. Page generated in 0.09018 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top