From 15dd97b485e03c9bf24a6ed18958cd59904482fa Mon Sep 17 00:00:00 2001 From: Egima profile Date: Mon, 5 Sep 2016 13:12:30 +0300 Subject: [PATCH] removed redundant makeSound sound method of abstract class Animal (#668) * made changes to java reflection * removed redundant method makeSound in Animal abstract class --- .../src/main/java/com/baeldung/java/reflection/Animal.java | 4 ---- .../java/com/baeldung/java/reflection/ReflectionTest.java | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/core-java/src/main/java/com/baeldung/java/reflection/Animal.java b/core-java/src/main/java/com/baeldung/java/reflection/Animal.java index 2107c7522d..3f36243c29 100644 --- a/core-java/src/main/java/com/baeldung/java/reflection/Animal.java +++ b/core-java/src/main/java/com/baeldung/java/reflection/Animal.java @@ -18,10 +18,6 @@ public abstract class Animal implements Eating { this.name = name; } - public String makeSound() { - return getSound(); - } - protected abstract String getSound(); } diff --git a/core-java/src/test/java/com/baeldung/java/reflection/ReflectionTest.java b/core-java/src/test/java/com/baeldung/java/reflection/ReflectionTest.java index 6639096ad1..a12a2f205f 100644 --- a/core-java/src/test/java/com/baeldung/java/reflection/ReflectionTest.java +++ b/core-java/src/test/java/com/baeldung/java/reflection/ReflectionTest.java @@ -124,7 +124,7 @@ public class ReflectionTest { assertEquals(4, actualMethods.size()); assertTrue(actualMethods.containsAll(Arrays.asList("getName", - "setName", "getSound", "makeSound"))); + "setName", "getSound"))); } @Test