Tags | tdd logging exception-handling log4j |
Hard Prerequisites | |
IMPORTANT: Please review these prerequisites, they include important information that will help you with this content. | |
|
You are required to create a back-end service that will help capture basic information about prospective students who come to inquire here at Umuzi. In this project you’ll just be storing and retrieving information from plain old txt files.
Create the following functionality in a TDD way. And make sure that everything has the correct Exception handling and those exceptional cases should have tests as well. In an error occured it through
save
that saves the visitor’s data to a Text file. The file name should be named like this visitor_{their_full_name}.txt
.On a successful save, a log to the console should be made using log4j and the same when an error occurs;
Make sure to use and handle the appropriate exception class for the expected errors
alice.save() # results in visitor_alice_cooper.txt
bob.save() # results in visitor_bob_marley.txt
charlie.save() # results in visitor_charley_sheen.txt
Notice that the full name used in the file is all lower-case and spaces are replaced by underscores.
load
that takes in a name and then grabs a Visitor object from file. It should simply System.out.println
the visitor.On a successful read, a log to the console should be made using log4j and the same when an error occurs;
eg:
Visitor.load("Alice Cooper")
// prints out all of Alice's information
Visitor.load("Bob Marley")
// Same deal for good ol Bob