How to write in junit3?

44 views Asked by At

I have written this code in junit4.

@Test (expected = AssertionError.class)
  public void testMinFail() {
    double min = emApp.minSalary(emApp.getEmployees());
    assertEquals(40000.0, min, 0);
  }
enter code here

I was just wondering how to catch this in junit3.

1

There are 1 answers

0
Ittiel On

If you really want to use older JUnit version, you can do something like that:

@Test 
  public void testMinFail() {

    try{
       double min = emApp.minSalary(emApp.getEmployees());
    }catch (AssertionError ae){
       //Do something here   
    }
    assertEquals(40000.0, min, 0);
  }