Menu
support@nursinghomework.org
+1 714-215-3097

(Solved) : Use Oracle Junit Testing Please Currently Developinga System Requires Class Convert Intege Q35630578

*use oracle Junit testing for this please ****

You are currently developinga system that requires a class toconvert an integer to the name of the day of the week.For example,0would be “Sunday”, 1would be “Monday”, and so on.Create aclasscalled “Week.java” that will represent the class for days oftheweek.It is a simple class –it contains one method calledgetDayOfWeek()and takes an integer. For example,getDayOfWeek(0)would return “Sunday”.How you design this class isup to you.When you develop the unit tests, try your hand at TDD bycreating the unit tests first, running the failing test, developingthe class code, and then creating the passing test.Yourtask istowrite the sourcecode(Week.java), and design, implement, andexecute passing JUnit unit tests for the Week.java. Create a newproject in Eclipse called “Project 6”. Create a class called“Week.java” in your “src”directory. Create a new directory called“test” to hold your JUnit VERSION 3(not VERSION 4) unit tests.Whenyou create the JUnit test, don’t forget to check the box forVersion 3.Let’s call this test class “DayOfWeekTest.java”.

C.

Try misspelling a day of the week or entering an integer that isnot in the switch statement;

does the test fail?

No need to take screenshots here

just practice making a test f

ail to see

what happens.

D.

In the

Week

.java file create a single method called getDayOfWeek()

that returns a

String

(a week day)

and takes a

integer (use Sunday as day zero, Monday as day one, etc)

.

E.

Use a switch statement to implement the

day of the week values (i.e. “Sunday”, “Monday”,

etc.)

.

Switch

statements are quite easy to understand and, you may alreadyhave had

some

experience with other languages

that use

case/switch statements. For more information on

the Java switch statement please turn your attention to thefollowing site by Oracle:

Leave a Reply

Your email address will not be published. Required fields are marked *