title: Junit testing for a function
body: <p>I have a confusion regarding Junit testing.For some functions(add function) with closed business logic we can make unit testing by asserting the function.</p>
  
  <p>For example</p>
  
  <pre><code>public int add(int a,int b){
    int c = a+b;
    return c;
  }
  </code></pre>
  
  <p>But for some function(as below example) in a route what methodology we have to do.</p>
  
  <p>For example</p>
  
  <pre><code>public int foo(int totalnum){
    Zoo soo = new Zoo();
    int giraffNumber = soo.giraffe(totalnum);//here we are calling another method
    return giraffNumber;
  }
  </code></pre>
  
  <p>For these kind of methods what approach we have to do.Does we need to write another class.</p>
  
  <p>Can anybody please advise me with an example. </p>