• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

JUNIT test fail message

 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to test HelloWorld2 class:


Following is the code of my HelloWorld2Test class:





I am getting the error message.


But If I comment both the fail statements i.e.



the test fail message shown in the image vanishes.

Please guide me is it fine to comment the fail statements shown in the above code?


Zulfi.
Testing-Hello-World2-class.jpg
[Thumbnail for Testing-Hello-World2-class.jpg]
 
Saloon Keeper
Posts: 11184
244
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The fail() method is just there to make sure you don't forget to implement your test methods.

Don't just comment them out, remove them completely. Unused code should not remain in your source files. If you want to keep code around for future use, use a versioning system.
 
Zulfi Khan
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for your advise. I would use a not condition with fail method.

I would try to learn versioning in NetBeans.

Zulfi.
 
Marshal
Posts: 6639
177
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would suggest you also learn git (a versioning application) from the command line.  There are things that integrate well into an IDE and thing that don't.  The book Pro Git is available in its entirety here.
 
Zulfi Khan
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for this great gift.

God bless you with more skills.


Zulfi.
 
Sunglasses. AKA Coolness prosthetic. This tiny ad doesn't need shades:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!