Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Have to create a test file similar to that of the PersonTest(shown in the first picture), for BookTest(shown in the first picture). I already have
Have to create a test file similar to that of the PersonTest(shown in the first picture), for BookTest(shown in the first picture). I already have all of the functions laid out, just need the code. The classes for book and person are in the second picture.
eclipse-workspace Lab1 kapoor/test/educe373/lab1/test/BookTest.java Edipse File Edit Source Refactor Navigate Search Project Run Window Help Person,java PersonTestjava Problerms o JavadocDeclaration Console zz term nated PersonFest pUnit] CAProgram FilesW vape1.80-1 1 1\bin Jove T 1 package edu.ece373.1ab1.test; 2-import edu.ece373.lab1.Person; 3 import static org.junit.Assert. .exe (Aug 29, 2017, 8:24:35 AM) import org.junit.Test; IRES 6 import static org, junit,Assert."; ed 5 import org.junit.Test; ^. 8 import org.junit. Test; 9 public class PersonTesti 7 import edu.ece373.1ab1.Person; 11 Test 9 import edu.ece373.1ab1.Book; 10 12 public final void testPerson) ( Person p1 new Person): Person p3-new Person("Griselda Hoyer assertEquals ("unknown", pi.getNameO) test ech 11 public class BookTest { 14 p2 -new Person("Joey", 5ee); 15 17 19 21 Test public final void testBook) JUnit 1 Book p1-new Book ); assertEquals(2, pi.getMaxBooks)) 16 assertEquals ( "Joey", p2.getName(O) assertEquals (5e0, p2.getMaxBooks()) 18 19 20 assertEquals("unknown", p1.getTitle)); assertEquals("unknown", pi.getAuthor)); assertEquals("unknown", pi.getPerson)) assertEquals( Griselda Hoyer", p3.getName)); assertEquals (8, p3.getMaxBooks)) 25 Test public final void testsetTitle) 23 Test 28 public final void testSetName) 25 26 Book p1 -new Book ); assertEquals("unknown", pl.getTitle)) Person P1 new Person(); assertEquals ("unknown", pl.gethameO) pl.setTitle("Roy") assertEquals("Roy", pi.getTitle()) 28 31 pl.setName("Roy") assertEquals( "Roy", pl.getName)) 30 31 32 Test public final void testSetAuthor) Book p1 = new Book(); assertEquals("unknown", pi.getPerson)) 36 Test 37 public final void testSetMaxBooks) 38 39 35 36 Person p new Person(); assertEquals (2, pi.getMaxBooks)) p1.setAuthor("Roy") assertEquals("Roy", pl.getAuthorO) p1.setHaxBooks (16777216); assertEquals (16777216, pl.getMaxBooks)) Test public final void testSetPerson() 41 Book p1 = new Book(); assertEquals (2, p1.getPerson)); 45 46 43 pi.setPerson(Person("Joey",5e0)); assertEquals (Person("Joey",5ea), pl.getPerson()); 48 58 51 Smart Insert 16:1 10:36 AMM 8/29/2017 Type here to searchStep 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