Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The bottom picture extends off of the top picture. The 3 pictures below are all one testing program which will the test Employee program above

image text in transcribed

The bottom picture extends off of the top picture.

image text in transcribed

The 3 pictures below are all one testing program which will the test Employee program above

image text in transcribed

image text in transcribed

image text in transcribed

I can't figure out why I'm still getting error highlights in the Employee program in the 2nd picture listed above.

\/ DO NOT MAKE ANY CHANGES TO THIS FILE public abstract class Person { private String name; public Person(String name) { setName (name); } // The use of final prohibits a child class from overriding this method. final public String getName() { return name; } // The use of final prohibits a child class from overriding this method. final public void setName(String name) { if (name == null) { throw new IllegalArgumentException ("Name must not be null"); } if (name.length() { 69 employee = new Employee(null, VALID_EMPLOYEE_ID_1, VALID_DEPARTMENT_1); 70 }); 71 Assertions.assertThrows (IllegalArgumentException.class, () -> { 72 employee = new Employee (EMPTY_STRING, VALID_EMPLOYEE_ID_1, VALID_DEPARTMENT_1); 73 }); 74 Assertions.assertThrows (IllegalArgumentException.class, () -> { 75 employee = new Employee (INVALID_NAME_1, VALID_EMPLOYEE_ID_1, VALID_DEPARTMENT_1); 76 }); 77 78 Assertions.assert Throws (IllegalArgumentException.class, () -> { 79 employee = new Employee (VALID_NAME_1, null, null); 80 }); 81 Assertions.assertThrows(IllegalArgumentException.class, () -> { 82 employee = new Employee(VALID_NAME_1, EMPTY_STRING, null); 83 }); 84 Assertions.assertThrows(IllegalArgumentException.class, () -> { 85 employee = new Employee (VALID_NAME_1, INVALID_EMPLOYEE_ID_1, INVALID_DEPARTMENT_1); 86 }); 87 } 88 @Test 62 @Test public void testConstructor30) { Assertions.assertThrows(IllegalArgumentException.class, () -> { employee = new Employee(null, VALID_EMPLOYEE_ID_1, VALID_DEPARTMENT_1); }); Assertions.assertThrows(IllegalArgumentException.class, () -> { employee = new Employee (EMPTY_STRING, VALID_EMPLOYEE_ID_1, VALID_DEPARTMENT_1); }); Assertions.assertThrows (IllegalArgumentException.class, () -> { employee = new Employee (INVALID_NAME_1, VALID_EMPLOYEE_ID_1, VALID_DEPARTMENT_1); }); Assertions.assertThrows (IllegalArgumentException.class, () -> { employee = new Employee (VALID_NAME_1, null, VALID_DEPARTMENT_1); }); Assertions.assertThrows (IllegalArgumentException.class, () -> { employee = new Employee (VALID_NAME_1, EMPTY_STRING, VALID_DEPARTMENT_1); }); Assertions.assertThrows(IllegalArgumentException.class, () -> { employee = new Employee (VALID_NAME_1, INVALID_EMPLOYEE_ID_1, VALID_DEPARTMENT_1); }); Assertions.assertThrows (IllegalArgumentException.class, () -> { employee = new Employee (VALID_NAME_1, VALID_EMPLOYEE_ID_1, INVALID_DEPARTMENT_1); }); Assertions.assertThrows(IllegalArgumentException.class, () -> { employee = new Employee (VALID_NAME_1, VALID_EMPLOYEE_ID_1, INVALID_DEPARTMENT_2); }); } @Test public void testSetName() { employee.setName(VALID_NAME_2); assertEquals(VALID_NAME_2, employee.getName()); Assertions.assertThrows (IllegalArgumentException.class, () -> { employee.setName(null); }); Assertions.assertThrows (IllegalArgumentException.class, () -> { employee.setName (EMPTY_STRING); }); Assertions.assertThrows(IllegalArgumentException.class, () -> { employee.setName(INVALID_NAME_1); }); Assertions.assertThrows(IllegalArgumentException.class, () -> { employee.setName(INVALID_NAME_2); }); } @Test public void testsetEmployeeID) { employee.setEmployee ID(VALID_EMPLOYEE_ID_2); assertEquals(VALID_EMPLOYEE_ID_2, employee.getEmployeeID); Assertions.assertThrows (IllegalArgumentException.class, () -> { employee.setEmployeeID(null); }); Assertions.assertThrows (IllegalArgumentException.class, () -> { employee. set Employee ID(EMPTY_STRING); }); Assertions.assertThrows (IllegalArgumentException.class, () -> { employee.setEmployeeID(INVALID_EMPLOYEE_ID_1); }); Assertions.assertThrows(IllegalArgumentException.class, () -> { employee.setEmployeeID(INVALID_EMPLOYEE_ID_2); }); } @Test public void testsetDepartment() { employee.setDepartment (VALID_DEPARTMENT_2); assertEquals(VALID_DEPARTMENT_2, employee.getDepartment(); Assertions.assertThrows (IllegalArgumentException.class, () -> { employee.setDepartment (INVALID_DEPARTMENT_1); }); Assertions.assertThrows (IllegalArgumentException.class, () -> { employee.setDepartment (INVALID_DEPARTMENT_2); }); } @Test public void testToString() { String expectedValue = "Name:" + VALID_NAME_1 + " - Employee ID: assertEquals(expectedValue, "" + employee); } + VALID_EMPLOYEE_ID_1 + " - Department: " + VALID_DEPARTMENT_1; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 2 Lncs 13427

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124251, 978-3031124259

More Books

Students also viewed these Databases questions

Question

What is the difference between fact witnesses and expert witnesses?

Answered: 1 week ago

Question

This is in matlab please,

Answered: 1 week ago