Denise :
I am trying to make my Thread sleep and am making the method throws InterruptedException, however it is still giving the error "Unhandled exception"
@Before
public void setUp() throws InterruptedException{
simulatorList.forEach(simulation -> {
....
Thread.sleep(1000*60*1);
//giving error here
...
});
}
ahmad adawi :
Because you calling Thread.sleep inside foreach, Below will solve your issue:
public void setUp() throws InterruptedException {
List<String> simulatorList = new ArrayList<>();
for (String s : simulatorList) {
Thread.sleep(1000 * 60 * 1);
}
}