@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());
  }
Esempio n. 2
0
 @Test
 public void typeOfTriangle_noSidesAreEqual_scalene() {
   Triangle triangle = new Triangle(10, 15, 11);
   assertEquals("It's a scalene!", triangle.typeOfTriangle());
 }
Esempio n. 3
0
 @Test
 public void typeOfTriangle_sideThreeSideOneEqual_isosceles() {
   Triangle triangle = new Triangle(10, 15, 10);
   assertEquals("It's an isosceles!", triangle.typeOfTriangle());
 }
Esempio n. 4
0
 @Test
 public void typeOfTriangle_sideOneSideTwoEqualSideTwoSideThreeEqual_equilateral() {
   Triangle triangle = new Triangle(10, 10, 10);
   assertEquals("It's an equilateral!", triangle.typeOfTriangle());
 }
Esempio n. 5
0
 @Test
 public void isATriangle_sideOneSideTwoLessThanSideThree_true() {
   Triangle triangle = new Triangle(10, 10, 15);
   assertEquals(true, triangle.isATriangle());
 }
Esempio n. 6
0
 @Test
 public void isATriangle_sideThreeSideOneGreaterThanSideTwo_false() {
   Triangle triangle = new Triangle(10, 25, 10);
   assertEquals(false, triangle.isATriangle());
 }
Esempio n. 7
0
 @Test
 public void testIsosceles() {
   Triangle t = new Triangle(20, 20, 30);
   String result = t.triangleType();
   assertEquals("Isosceles", result);
 }
Esempio n. 8
0
 @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);
 }
Esempio n. 9
0
 // 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);
 }
Esempio n. 10
0
 @Test
 public void testEquilateral() {
   Triangle t = new Triangle(10, 10, 10);
   String result = t.triangleType();
   assertEquals("Equilateral", result);
 }
Esempio n. 11
0
 /**
  * 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);
 }
Esempio n. 12
0
 @Test
 public void PerimeterTest() {
   Triangle B = new Triangle(12, 16, 20);
   assertTrue(B.getPerimeter() == 48);
 }
Esempio n. 13
0
 @Test
 public void AreaTest() {
   Triangle A = new Triangle(3, 4, 5);
   Triangle B = new Triangle(6, 8, 10);
   assertTrue(A.getArea() == B.getArea());
 }