• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to write test case for if condition

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Iam very new to junit, iam trying junit at first time so please guide to this will be foundation for me to get concepts about junit.

My code was


This code is having link to private method but simple 2 are 3 steps i want to get idea clear.so help me. I tried some little code in that iam getting error so please help me and guide me.

my junit code


my error is

Please help me

 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jenifer Rajakumar wrote:my error is



That is relatively straightforward - you will find it an easy fix. I'm going to point you to the documentation since it explains it better than I can:

You might want to look at Oracle's Controlling Access to Members of a Class tutorial. Or possibly a better bet (since the first link is a bit terse), the Oracle lesson on Object-Oriented Programming -> Data Access Levels might point you to the easy fix.
 
Ranch Hand
Posts: 51
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jenifer Rajakumar wrote:My code was my junit code



Just to add to what Andrew he pointed you...

Exception trace has given you a message; Method testGetInitiateSearchEntities should be public , and I believe it is detailed enough.

Also if you look at the getInitiateSearchEntities() and testGetInitiateSearchEntities() methods, first one has public, but not the second one. So always make a practice to read the exception content and see whether you can grab something on how to resolve it.
reply
    Bookmark Topic Watch Topic
  • New Topic