• 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
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

JUNIT test fail message

 
Ranch Hand
Posts: 163
  • 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: 12484
269
  • 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: 163
  • 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.
 
Sheriff
Posts: 7108
184
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: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for this great gift.

God bless you with more skills.


Zulfi.
 
reply
    Bookmark Topic Watch Topic
  • New Topic