Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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: 12199
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.
 
Slideshow boring ... losing consciousness ... just gonna take a quick nap on this tiny ad ...
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic