Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this lab, we are going to write tests for the comparable implementation we wrote for Interfaces and Generics Part 1 and Part 2. Here
In this lab, we are going to write tests for the comparable implementation we wrote for Interfaces and Generics Part 1 and Part 2. Here is what you want to do - 1. Create a folder called sre. It stands for "source", where we will place our source files. 2. Inside src, create a folder called Unittesting. This is meant to represent a package called unittesting. We want every class to belong to a package, as it helps when test classes and source classes are of the same package. 3. Copy your comparable interface implementation from Interfaces and Generics - Part 1 to this Unittesting folder. 4. Add a package declaration line - package Unittesting; at the top. 5. Copy your coords class implementation from Interfaces and Generics - Port 1 to this UnitTesting folder. Add package Unittesting; to the top. 6. Copy your student class implementation from Interfaces and Generics - Part 2 to this unittesting folder. Add package Unittesting; to the top. It is essential that each dass in this project belongs to the same package. 7. Create a folder called test. This is where we will place our test files. 8. Inside test, create a folder called unittesting. This is meant to represent a package called unittesting . 9. Create two classes here called coordstest and studentTest. You can copy your calculatortest contents from previous lab here, and then modify it to contain tests for coords and student respectively. You can write your tests in such a way that the only thing that changes between and is the creation of test objects. As they both implement you have the opportunity to reuse the rest of the code you write. This is what it should look like, in the end - 10. Once you've implemented tests for each, first make sure your tests are passing. 11. Once they are passing you can hit check answer to run mutation testing. You cannot run mutation tests (hit chieck answer) oOrdsTest.java x StudentTest.java CoOrds.java x Student.java oOrdsTest.java StudentTest.java CoOrds.java package UnitTesting; public class Student implements comparable ff string name; char grade; public Student() \{\} public int compareTo(Student other) \{ if (grade > other.grade) \{ return 1; \} else if (grade ()> other. name.charAt ()){ return 1; \} \} return ; \} CalculatorTest.java settings.json history.txt Calculator.java CalculatorTest.java x settings.json x history.txt x Calculator.java
Step 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