I'm trying to implement a RESTful java web services, and I have some question:
I'm making an online shopping web services with following spec (this is just the basics):
1. Customer : CustomerID, Name, Address, PhoneNumber
2. Order (by Customer) : OrderID, CustomerID, CreationDate, GrandTotal (from Parts)
3. Part (by Order) : OrderID, PartID, UnitCost, Quantity, LineTotal (Unit * Quantity)
Now, think specifically about these User Stories related to the Orders (not Customers, not Parts):
1. Customer lists orders to know which orders she has placed
2. Customer creates a new order to be fulfilled.
3. Customer views an existing order to get a reminder of what was ordered
4. Customer updates an order (add or delete parts, or changes quantity) when she realizes it is incorrect.
5. Customer can delete an order that is no longer needed (let’s not worry about if the order has been processed now)
I'm quite new with JUnit. I'm already familiar with @Before, @BeforeClass, @Test and have been using JUnit for some time now. Right now I want to test specifically the "placing an order" part. what should I focus my testing on for this part? security? if so, what's the best practice for that? are mock object and stub used here?thanks
Joined: Oct 30, 2012
right now I just want to test the correctness of a customer updates his order. how do I do this? mock objects or stubs? so, something like this:
I'm using JSON format because it's easier to desribe the object although the object that will be tested is java object (Order class and Part class). This JSON format represents the state of the Java objects and the changes during order update: