How do I write the JUnit tests for the following interface?
Question.java
package cs5004.questionnaire;
/**
* Represents the Question interface outlining the methods for a standard Question.
*/
public interface Question
{
/**
* Retrieves the question in the form of a String from a given object.
*
* @returns the question in the form of a String.
*/
public abstract String getPrompt();
/**
* Retrieves the boolean requirement of whether or not the question is required.
*
* @returns the boolean of the requirement.
*/
public abstract boolean isRequired();
/**
* Retrieves the answer that the user answered the question with.
*
* @returns the answer in the form of a string.
*/
public abstract String getAnswer();
/**
* Copies or duplicates the Question object in addition to its associated data.
*
* @returns a copy of the Question object.
*/
public abstract Question copy();
/**
* Allows the user to answer the question in which a String called answer is given.
* @param answer in the form of a String.
* @returns a copy of the Question object.
*/
public abstract void answer(String answer);
}
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
- I need help fix this Java code described below so that it can be followed in the image below package classPackage; import interfaces.RatInterface; public class Rat implements RatInterface { private int ratEnergy = 5; @Override public String move() { // TODO Auto-generated method stub returnnull; } @Override publicint getAliveState() { // TODO Auto-generated method stub return 0; } @Override publicvoid refresh() { ratEnergy = 5; } @Override publicvoid wearDown() { ratEnergy -= 1; } @Override public String getId() { // TODO Auto-generated method stub returnnull; } }arrow_forwardUSING JAVA: Part A) Implement a superclass Appointment and subclasses Onetime, Daily, and Monthly. An Appointment has a description (for example, “See the dentist”) and a date. Write a method, occuresOn(int year, int month, int day) The check whether the appointment occurs on that date. For example, for appointment, you must check whether the day of the month matches. This fill an array of Appointment objects with a mixture of appointments. Have the user enter a date and print out all appointments that occur on that date. Part B) Improve the appointment book by giving the user the option to add new appointments. The user must specify the type of the appointment, the description, and the date.arrow_forwardRefer to the following interface: Provide two examples (screenshots) that in many ways could improve the above or similar interface using the principles of direct manipulation. Explain the relevant improvements as well. (Examples might have different object, labels and organization)arrow_forward
- USING JAVA Write these: An interface called Shape that has two methods: area and perimeter. A class Rectangle that implements Shape and has a length and a width. A class Circle that implements Shape and has a radius. For each class, write the needed constructors, getters, setters, and a toString method that stringifies the instance variables in a readable format. Supply a test program that instantiates an instance of each class and exercises each method defined for the class.arrow_forward// interface method ==================================================public boolean isFullBT() {/*See BST.java for method specification *//* Hint: How can you "break-up" the problem into smaller pieces? *//* Your code here */return false; // Dummy return statement. Remove when you implement!} IN JAVA LANGUAGE RETURN TRUE IF BST IS A COMPLETE BST RETURN FALSE IS BST IS NOT A COMPLETE BST ALL INFO IN PICTURES PLS AND THANK YOU!!!!!arrow_forwardJava programarrow_forward
- In java, can a polymorphic reference invoke a method that is only declared at the object's class level? If "yes", explain how.arrow_forwardCan you please help me with this, its in java. Thank you. Write classes in an inheritance hierarchy Implement a polymorphic method Create an ArrayList object Use ArrayList methods For this, please design and write a Java program to keep track of various menu items. Your program will store, display and modify salads, sandwiches and frozen yogurts. Present the user with the following menu options: Actions: 1) Add a salad2) Add a sandwich3) Add a frozen yogurt4) Display an item5) Display all items6) Add a topping to an item9) QuitIf the user does not enter one of these options, then display:Sorry, <NUMBER> is not a valid option.Where <NUMBER> is the user's input. All menu items have the following: Name (String) Price (double) Topping (StringBuilder or StringBuffer of comma separated values) In addition to everything that a menu item has, a main dish (salad or sandwich) also has: Side (String) A salad also has: Dressing (String) A sandwich also has: Bread type…arrow_forward15. Create an interface MessageEncoder that has a single abstract method encode (plainText), where plainText is the message to be encoded. The method will return the encoded message.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education