Sample JUnit Test Suite and Program Source Code

This is the JUnit test suite for the triangle identification problem:

com.wpollock.triangles.Triangles.java source code of sample application solution under test.

com.wpollock.trianglestest.TrianglesTestSuite.java source code.

You can also view the Triangles Git repo visualization and log.

It is important to realize that a through job of testing, such as demonstrated here, is only possible with the most trivial applications.  (And even in this case, not all possible tests have been implemented!)  In reality, developers must pick a small number of tests to implement, at least initially.  A few happy path tests, a couple of boundary value tests, and a couple of illegal input values, per unit.  Anything more than a few hundred lines of test code per unit/module will usually be too expensive to implement.  Keep things simple to start with, and add additional test cases if you have time.

Over time, you will undoubtedly add addition test cases, as new features are enabled, and new bugs are discovered.  Initially however, you should keep to a manageable number of test cases per unit.