java - Unit testing a class with constructor as the only public method -


I have a class that is given below:

  class ToTest {Private subscribers Member member; Private member two members two; Public Totest (Parmen Parmen, Paramatwo Ultimate) {setMemberOne (paramOne); SetMemberTwo (paramTwo); } Private Setembaron (Parman Paranoan) {// Build Object} Private Setmember 2 (Paragraph 2 Ultimate Two) {// Build another object}}  

Due to setters only through constructor medium Can be accessed from that I do not want to change an object once, because there is dependency between memberOne and member two (An example may be that member Displays a table header and member two rhythm Represents the data in and checks to keep the coding simple and free of restrictions if the number of columns is equal in the header and the data set.)

As an exercise I am using personal methods Does not write cases of test. What would be a good strategy to write the test cases for this class.

you member one and member two one For different classes

  private setMemberOne (ParamOne paramone) {memberOne = new MemberOneBuilder (). BuildFromParam (paramOne); }  

  public class membersonbilder {public subscribers build paramaparam (param-on-paragon) {....}}  

Now you can easily examine the building process separately.


Comments