Am not getting Failures in junit when i use assertion | Selenium Forum
M
Posted on 02/12/2015
PLs refer the code below:

package testcases;

import org.junit.After;
import org.junit.Assume;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.rules.ErrorCollector;

import junit.framework.Assert;

public class testcase1 {

@BeforeClass
public static void callingMyself()
{
ErrorCollector collector= new ErrorCollector();
int x=8;
System.out.println("callingMyself");
try{
Assert.assertEquals(1,x);
}
catch(Throwable t)
{
System.out.println("Error encountered");
//ErrorCollector.addError(t);
collector.addError(t);
try{
Assert.assertEquals(1,2);
}catch(Throwable r)
{
System.out.println("Error encountered");
//ErrorCollector.addError(t);
collector.addError(r);
}

}

}
i should be getting 2 failures here in Junit.I get none.Please tell me have i missed imports?

M
Replied on 02/12/2015

i am not able to understand the question. can you please try again.