 <blockquote> <p>I don't want to create B class object </p> </blockquote> <p>Add a constructor or factory method which doesn't require a B.</p> <pre><code>public A(B b){ this(b.getList()); } /* package local */ A(List&lt;String&gt; list){ this.list = list; } </code></pre> <p>By making the constructor package local it can be accessed by unit tests in the same package.</p> <blockquote> <p>How to test someMethod without calling constructor of A?</p> </blockquote> <p>You can use </p> <pre><code>A a = theUnsafe.allocateInstance(A.class); </code></pre> <p>but this is not recommended unless you have no other option e.g. deserialization.</p>