@Test public void test() { Triangle t = new Triangle("20,50", "100,90", "70,150"); assertTrue(t.isRightAngle()); t.setTriangle("30,75", "25,0", "-50,45"); assertFalse(t.isRightAngle()); }
@Test public void typeOfTriangle_noSidesAreEqual_scalene() { Triangle triangle = new Triangle(10, 15, 11); assertEquals("It's a scalene!", triangle.typeOfTriangle()); }
@Test public void typeOfTriangle_sideThreeSideOneEqual_isosceles() { Triangle triangle = new Triangle(10, 15, 10); assertEquals("It's an isosceles!", triangle.typeOfTriangle()); }
@Test public void typeOfTriangle_sideOneSideTwoEqualSideTwoSideThreeEqual_equilateral() { Triangle triangle = new Triangle(10, 10, 10); assertEquals("It's an equilateral!", triangle.typeOfTriangle()); }
@Test public void isATriangle_sideOneSideTwoLessThanSideThree_true() { Triangle triangle = new Triangle(10, 10, 15); assertEquals(true, triangle.isATriangle()); }
@Test public void isATriangle_sideThreeSideOneGreaterThanSideTwo_false() { Triangle triangle = new Triangle(10, 25, 10); assertEquals(false, triangle.isATriangle()); }
@Test public void testIsosceles() { Triangle t = new Triangle(20, 20, 30); String result = t.triangleType(); assertEquals("Isosceles", result); }
@Test public void testInvalid() { Triangle t = new Triangle(2, 5, 7); String result = t.triangleType(); assertEquals("The lengths of the triangles do not form a valid triangle!", result); }
// TODO: CREATE MORE TESTS @Test public void testNegative() { Triangle t = new Triangle(10, -10, 2); String result = t.triangleType(); assertEquals("At least one length is less than 0!", result); }
@Test public void testEquilateral() { Triangle t = new Triangle(10, 10, 10); String result = t.triangleType(); assertEquals("Equilateral", result); }
/** * We've already created a testScalene method. Please fill in testEquilateral, and additionally * create tests for Isosceles, Negative Sides, and Invalid sides */ @Test public void testScalene() { Triangle t = new Triangle(30, 40, 50); String result = t.triangleType(); assertEquals("Scalene", result); }
@Test public void PerimeterTest() { Triangle B = new Triangle(12, 16, 20); assertTrue(B.getPerimeter() == 48); }
@Test public void AreaTest() { Triangle A = new Triangle(3, 4, 5); Triangle B = new Triangle(6, 8, 10); assertTrue(A.getArea() == B.getArea()); }