Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please solve this Part 3 - Coding Problems 20. (8 pts) You have the following test routine: package spring 2020. DogAndCat Interface: import statie org.unit.jupiter.api.Assertions.
please solve this
Part 3 - Coding Problems 20. (8 pts) You have the following test routine: package spring 2020. DogAndCat Interface: import statie org.unit.jupiter.api.Assertions. import org.unit.jupiter.api. BeforeAll import org. junit.jupiter.api.BeforeEach; import org. junit.jupiter.api. Test; class Animal Test @BeforeAll static void setUpBeforeClass() throws Exception @Before Each void setup() throws Exception Test void test() { Dog Riker = new Dog ("Riker"); assertEquals (Riker.getName(), "Riker"); Cat Skippy = new Cat ("Skippy"); assertEquals (Skippy.getName(), "Skippy"); @Test void testArray() { Dog Riker = new Dog ("Riker"); Animal [] pets = {Riker, new Cat ("Skippy") }; StringBuilder sb = new StringBuilder (); for (Animal pet: pets) { sb.append(pet.getName()); assertEquals ("RikerSkippy", sb.toString(); Write Animal, Dog, and Cat classes. Try to put as much code as you can into Animal so that Dog and Cat have the least amount of codeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started