31 lines
631 B
Java
31 lines
631 B
Java
package Playground.ExceptionsP;
|
|
|
|
import org.junit.After;
|
|
import org.junit.Before;
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
class CalculatorTest {
|
|
Calculator c = new Calculator(10, 0);
|
|
|
|
@Test
|
|
void sum() throws CalException {
|
|
System.out.println("Sum: " + c.sum());
|
|
assertEquals(10, c.sum());
|
|
}
|
|
|
|
@Test
|
|
void sub() throws CalException {
|
|
assertEquals(10, c.sub());
|
|
}
|
|
|
|
@Test
|
|
void div() throws CalException {
|
|
assertThrows(CalException.class, () -> c.div());
|
|
}
|
|
|
|
@After
|
|
public void tearDown() throws Exception {
|
|
}
|
|
} |