Rename surfaceAreaTriangle for clarity (#4220)

This commit is contained in:
THIRUMURUGAN 2023-06-23 22:09:10 +05:30 committed by GitHub
parent 63739f4933
commit 05ca93eace
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -100,7 +100,7 @@ public class Area {
* @param height height of triangle
* @return area of given triangle
*/
public static double surfaceAreaTriangleRectangle(final double base, final double height) {
public static double surfaceAreaTriangle(final double base, final double height) {
if (base <= 0) {
throw new IllegalArgumentException(POSITIVE_BASE);
}

View File

@ -35,8 +35,8 @@ class AreaTest {
}
@Test
void testSurfaceAreaTriangleRectangle() {
assertEquals(50.0, Area.surfaceAreaTriangleRectangle(10, 10));
void testSurfaceAreaTriangle() {
assertEquals(50.0, Area.surfaceAreaTriangle(10, 10));
}
@Test
@ -81,9 +81,9 @@ class AreaTest {
()
-> assertThrows(IllegalArgumentException.class, () -> Area.surfaceAreaSquare(0)),
()
-> assertThrows(IllegalArgumentException.class, () -> Area.surfaceAreaTriangleRectangle(0, 1)),
-> assertThrows(IllegalArgumentException.class, () -> Area.surfaceAreaTriangle(0, 1)),
()
-> assertThrows(IllegalArgumentException.class, () -> Area.surfaceAreaTriangleRectangle(1, 0)),
-> assertThrows(IllegalArgumentException.class, () -> Area.surfaceAreaTriangle(1, 0)),
()
-> assertThrows(IllegalArgumentException.class, () -> Area.surfaceAreaParallelogram(0, 1)),
()