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