Suppose there are several classes A, B, and C. We test A. The other classes are mocks. Class A has a method within which it uses B and C, and produces a result.
Is it necessary to test that class A interacts with B and C, or to write one test in which the result of executing method A will be checked?
Do such a test in the following case:
class A implements B.OnBarCallback { private B b; public A(B b) { this.b = b; } public void foo() { b.bar(this); } @Override public void onBar() { // do something } } // тест вызова B void testCallB() { B mockB = mock(B.class); A a = new A(mockB); a.foo(); verify(mockB).bar(any(OnBarCallback.class)); } // тест callback void testACallback() { B mockB = mock(B.class); A a = new A(mockB); a.onBar(); // do verify something } Is it correct to manually pull the callback method in the test?