Help coderanch get a
new server
by contributing to the fundraiser
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

doubt in this code

 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
suppose in my original code am reading a properties file

and now suppose in my testclass am doing



i copied it from somewhere else. please can anyone explain what is happening in assertNotNull(valueProp) line?
can anyone explain the meaning?
 
J radolf
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is it enough if we write so much how can we test it. when am trying to run the junit . it is giving me error like no junits found in eclipse.
 
J radolf
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is it valid to write try catch block within a junit testmethod?
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) assertNotNull() will record a test failure if the argument is null. So that test will succeed if loadProperties() returns non-null.

2) To help you with this problem, you'd need to be a little more precise about what error you're seeing. You need to have your test project include the org.junit plugin that comes with Eclipse on its build path, so perhaps that's the issue you're seeing.

3) Sure, why not? A test method can include any code you want. I often write tests like

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic