I/O Streams, Serialization, Deserialization and JUnit Testing
Amacon.com (Version 2.0)
Congratulations! Amacon.com is very pleased with your software Version 1.0 (Lab5) and now
they have decided to give you another contract to implement the Version 2.0 of the Amacon
software. Note that you must use the Amacon.com software you developed in Lab5 to
implement this Version 2.0. Just in case if you did not submit Lab5, you can still attempt this
Lab6 but you will have to first implement Lab5 before you start Lab6 implementation (using
someone else’s code is plagiarism). However, we will only evaluate the code specific to Lab6
but not Lab5.
In this Version 2.0, you have to extend the Amacon.com platform to make it more user-friendly
and to ensure that the system is also foolproof. These new set of requirements from
Amacon.com are as following:
1. Version 2.0 platform should welcome recurring customers. It should be able to identify
each customer by a unique username (case sensitive) and save the customer’s cart
state after each session. Platform should allow the returning customer to recall their cart
the next time they log in Amacon.com.
2. Version 1.0 platform is extremely impractical for the admins as they have to re-initialise
the database before every admin sessions. Version 2.0 platform should maintain the last
modified state of its database across all admin and customer sessions.
3. Version 2.0 platform should be robust to corner cases and should never crash. JUnit
based unit testing is a good way of testing your platform effectively and
comprehensively. You have to design a JUnit Test Suite for the Amacon system that
contains different JUnit test cases for testing different functionality of Amacon.com
Version 2.0 as mentioned below:
a. Test Cases to validate user defined Exceptions mentioned in Version 1.0:
i. Inserting the same product at the same path.
ii. Deleting a product which does not exist.
iii. Searching for a product which does not exist.
iv. Adding a product to the cart which is out of stock
v. Checking out the cart when the customer is out of funds
b. Test Cases related to database modifications in Version 2.0:
i. Test the serialization of database
ii. Test the serialization of customer cart