h1

Case 2 – JUnit tests, Collections, and JavaBeans

Think-Design-Write Test-Code

junitrelationship5 Days

  • Description

Congratulations! You have just been hired for a junior programming position with Mighty Corp.

Your boss comes to you and gives you your first assignment.  It includes a UML class diagram describing two new classes, Chat and Message.  See Figure 1 – 2.

Figure 1-2:  The class diagram for case 2

Figure 1-2: The class diagram for case 2

She explains that your assignment is to implement the ability to store , in memory, all messages  that are sent.  These messages are to be grouped by to whom they are sent and then sorted by when they are sent, earliest to latest.

Messages should be able to be added one at a time via the addMessage method of the Chat class and all messages for an individual must be retrievable by making one method call to the Chat class getMessagesFor method.

Each message is to be stored as a JavaBean called Message as seen in the UML Class diagram.

She then says,”I’ll come back tomorrow morning and see how you are doing.”  You dig in and start to work.

Leave a Comment