EasyMock - Mock a class having other class object and .class as parameters
<p>I am currently using EasyMock and trying a lot to fix my problem.</p>

<p>Let me explain you in the simple words, Totally I have 5 classes.</p>

<ul>
<li>Main.java</li>
<li>A.java</li>
<li>B.java</li>
<li>C.java</li>
<li>Result.java</li>
</ul>

<p>From Main.java I am calling a method of A.java</p>

<pre><code>objectOfA.someMethod("String",objectofB, C.class);
</code></pre>

<p>While Mocking...</p>

<pre><code>expect( objectofA.someMethod( "given some String", Prepared some dummy object of B and passing , C.class ) ).andReturn( objectofResult ).anyTimes();
</code></pre>

<p>While I am running the application its giving AssersionError.</p>

<p>My Questions:</p>

<ol>
<li><p>In the expect method > while calling objectofA.someMethod(), In the second parameter I am creating one dummy object of B, actually B has nearly 10 variables and among them one will be generated randomly, but while creating the dummy object I am giving some value of my own, will it be a problem ?</p></li>
<li><p>3rd parameter, we have to pass C.class, How can we pass this ?</p></li>
<li><p>Finally in andReturn() I am passing objectofResult class, do I need to parpare the dummy object of Result in this case ? because in Result.java we have nearly 20 variables and its really difficult for me to guess the values.</p></li>
</ol>

<p>In Result.java I just need to verify a single String variable value.</p>

<p>I am trying a lot since 3 days, can someone help me to fix this please.</p>