package Examples; import org.junit.* ; import Examples.IntTriangle; import static org.junit.Assert.* ; public class TestIntTriangle { IntTriangle equilateral() { return new IntTriangle(1,1,1) ; } IntTriangle isoceles() { return new IntTriangle(1,2,1) ; } IntTriangle scalene() { return new IntTriangle(1,2,3) ; } @Test public void test() { assertTrue(equilateral().isEquilateral()) ; assertTrue(equilateral().isIsoleces()) ; assertFalse(equilateral().isScalene()) ; assertFalse(isoceles().isEquilateral()) ; assertTrue(isoceles().isIsoleces()) ; assertFalse(isoceles().isScalene()) ; assertFalse(scalene().isEquilateral()) ; assertFalse(scalene().isIsoleces()) ; assertTrue(scalene().isScalene()) ; } @Test public void illegalTriangle() { try { new IntTriangle(0,1,1) ; assertTrue(false) ; } catch(IllegalArgumentException e) { } try { new IntTriangle(1,0,1) ; assertTrue(false) ; } catch(IllegalArgumentException e) { } try { new IntTriangle(1,1,0) ; assertTrue(false) ; } catch(IllegalArgumentException e) { } } }