Junit | How to test parameters in a method

Posted by MMRUser on Stack Overflow See other posts from Stack Overflow or by MMRUser
Published on 2012-09-13T03:25:37Z Indexed on 2012/09/13 3:38 UTC
Read the original article Hit count: 139

Filed under:
|
|
|

How do I test parameters inside a method itself. For example

class TestClass {

public void paraMethod(String para1, String para2) {
         String testPara1 = para1;
         String testPara2 = para2; 
}
}

class TestingClass {

   @Test
   public void testParaMethod () throws Exception {
             String myPara1 = "MyPara1"; 
             String myPara2 = "MyPara2";

             new TestClass().paraMethod(myPara1, myPara2);

   }
}

Ok, so is it possible to test if the testPara1 and testPara2 are properly set to the values that I have passed?

Thanks.

© Stack Overflow or respective owner

Related posts about java

Related posts about unit-testing