ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 02 May 2017 My Price 8.00

creating a class called person and pass these methods

I have attached a file of person Test. I want to pass all the tests given in there by creating a class called person and pass these methods in it. 

 

 

/*
* To change this license header, choose License Headers in Project
Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package w17oopassignment1;
import
import
import
import
import
import
import
import java.time.LocalDate;
java.time.Month;
org.junit.After;
org.junit.AfterClass;
org.junit.Before;
org.junit.BeforeClass;
org.junit.Test;
static org.junit.Assert.*; /**
*
* @author JWright
*/
public class PersonTest {
Person validPerson;
public PersonTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
validPerson = new Person("Anita", "Job", "31 Employment Ave",
"Happivale", "ON","T3T2B2", LocalDate.of(2000, Month.MAY, 10));
}
@After
public void tearDown() {
} /**
* Test of getYearBorn method, of class Person.
*/
@Test
public void testInvalidPerson() {
System.out.println("Test creation of invalid Person");
try { Person invalidPerson = new Person("Anita", "Job", "31 Employment
Ave", "Happivale", "ON","T32B2", LocalDate.of(2000, Month.MAY, 10));
fail("the invalid postal code should have thrown an exception");
}
catch (IllegalArgumentException e)
{
}
}
/**
* Test of getYearBorn method, of class Person.
*/
@Test
public void testGetYearBorn() {
System.out.println("getYearBorn");
int expResult = 2000;
int result = validPerson.getYearBorn();
assertEquals(expResult, result);
}
/**
* Test of getAge method, of class Person.
*/
@Test
public void testGetAge() {
System.out.println("getAge");
int expResult = 16;
int result = validPerson.getAge();
assertEquals(expResult, result);
}
/**
* Test of setPostalCode method, of class Person.
*/
@Test
public void testSetPostalCodeValid() {
System.out.println("setPostalCode");
String postal = "B3B7H7";
validPerson.setPostalCode(postal);
assertEquals(postal, validPerson.getPostalCode());
}
/**
* Test of setPostalCode method, of class Person with invalid inputs.
*/
@Test
public void testSetPostalCodeInvalid() {
System.out.println("setPostalCode");
String postal = "B3B7H";
try
{
validPerson.setPostalCode(postal);
fail("setPostalCode should have thrown an exception");
}
catch (IllegalArgumentException e) {
} } /**
* Test of changeAddress method, of class Person.
*/
@Test
public void testChangeAddress() {
System.out.println("changeAddress");
String street = "86 Kingsman Way";
String city = "Edenvale";
String province = "ON";
String postalCode = "K9LW2S";
validPerson.changeAddress(street, city, province, postalCode);
assertEquals(validPerson.getFullAddress(), "86 Kingsman Way, Edenvale,
ON, K9LW2S");
}
/**
* Test of getFirstName method, of class Person.
*/
@Test
public void testGetFirstName() {
System.out.println("getFirstName");
String expResult = "Anita";
String result = validPerson.getFirstName();
assertEquals(expResult, result);
}
/**
* Test of getLastName method, of class Person.
*/
@Test
public void testGetLastName() {
System.out.println("getLastName");
String expResult = "Job";
String result = validPerson.getLastName();
assertEquals(expResult, result);
}
/**
* Test of getStreetAddress method, of class Person.
*/
@Test
public void testGetStreetAddress() {
System.out.println("getStreetAddress");
String expResult = "31 Employment Ave";
String result = validPerson.getStreetAddress();
assertEquals(expResult, result);
}
/**
* Test of getCity method, of class Person. */
@Test
public void testGetCity() {
System.out.println("getCity");
String expResult = "Happivale";
String result = validPerson.getCity();
assertEquals(expResult, result);
}
/**
* Test of getProvince method, of class Person.
*/
@Test
public void testGetProvince() {
System.out.println("getProvince");
String expResult = "ON";
String result = validPerson.getProvince();
assertEquals(expResult, result);
}
/**
* Test of getPostalCode method, of class Person.
*/
@Test
public void testGetPostalCode() {
System.out.println("getPostalCode");
String expResult = "T3T2B2";
String result = validPerson.getPostalCode();
assertEquals(expResult, result);
}
/**
* Test of getBirthdate method, of class Person.
*/
@Test
public void testGetBirthdate() {
System.out.println("getBirthdate");
LocalDate expResult = LocalDate.of(2000, Month.MAY, 10);
LocalDate result = validPerson.getBirthdate();
assertEquals(expResult, result);
}
}

Answers

(11)
Status NEW Posted 02 May 2017 08:05 AM My Price 8.00

-----------

Attachments

file 1493713139-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)