Exemple #1
0
  @Test
  public void testTotalArea() {
    // Given
    List<Shapes> contents = Arrays.asList(new Circle(5), new Rectangle(3, 6), new Triangle(7, 2));
    ToyBox toyBox = new ToyBox(contents);

    // When
    double totalArea = toyBox.calculateTotalArea();
    double expectedTotalArea = (25 * Math.PI) + 18 + 7;

    // Then
    assertThat(totalArea, is(expectedTotalArea));
  }