mahesh
mahesh

Reputation: 1633

debug test case in java

Why the debug point not moving to if else clause below, there was no error in testServ method and working as expected.

@Test
public void testXMAS() {
    StringBuffer fb = xmsObj.testServ("XZXZXXX", 25, "", "", "");

    if (fb != null)
       logger.debug("ABCD done , issues: " + fb.toString());
    else
       logger.debug("ABCD not done , successfull:");
    }
}   

after executing below loop is not going to return sb statement in the testServ() method? That is why debug point in @Test class is not triggering.

                    while (br.readLine() != null) {
                String returnString = br.readLine();
                if (rString.contains("eee")) {
                    log.debug(" Mie:" + rString);
                }
            }

Upvotes: 0

Views: 358

Answers (2)

JVMATL
JVMATL

Reputation: 2122

if neither the if nor else clause is executing, then either testServ isn't terminating, or it's throwing an unchecked exception which you are propagating up...

Upvotes: 1

Max Meijer
Max Meijer

Reputation: 1729

Your stringbuffer is called fb, you are checking if sb is null

Upvotes: 1

Related Questions