Unit testing in java- testing a server process
I've recently implemented a functional feature in an ERP system. This feature is a promotion evaluation process that
(1)Checks a sales order and loads all valid promotions.
(2)Depending on the configuration of the model of a particular promotion, it assesses the order and gives the corresponding reward if any.
Hope I explained it well!
For example if a customer has bought 7 products, (say product X) and lucky him, there's a promotion that says buy 7X get 50% discount, that customer (as you guessed) will get 50% discount...Simple isn't it
My question is I've been trying to figure out how to write a unit test for that process.
The thing is, there is only one public method to that class and it is the startProcess() method (which obviously launches the process).
I may be wrong but I think it is not possible to test this method....I mean the process can have an extremely large no. of possible inputs (sales orders) and an equally large no. of outputs (rewards), everything being subject to the no. of promotions available! How is it possible to write a unit test for that??
I hope somebody can help me...I'm going crazy here! Maybe my idea of unit test is totally wrong...I believe that unit testing in java is about testing a class (i.e. a unit in java). Testing a class means testing all its public methods. Am I right? If so, is it possible to test such a process?
Last Post: 08-31-2009, 01:50 AM
By rperez in forum Database
Last Post: 01-02-2009, 05:14 PM
Last Post: 09-19-2007, 06:58 AM
Last Post: 06-02-2006, 10:00 PM
Last Post: 09-15-2000, 09:44 AM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL