@Test public void importMocksFromExpectationBlocksWhereTheFirstHasNoMockFields( final SubDependency sub) { new NonStrictExpectations() { { sub.setSomethingElse(anyString); result = 1; } }; new NonStrictExpectations() { Dependency mock; { mock.notifyBeforeSave(); result = true; } }; sub.notifyBeforeSave(); sub.notifyBeforeSave(); new Verifications() { Dependency mock1; SubDependency mock2; { mock1.notifyBeforeSave(); minTimes = 2; } }; }
@Test public void importMocksFromMultipleExpectationBlocks() { SubDependency subDependency = new SubDependency(); new NonStrictExpectations() { Dependency mock; }; new NonStrictExpectations() { SubDependency mock; { mock.notifyBeforeSave(); result = true; } }; subDependency.notifyBeforeSave(); new FullVerificationsInOrder() { Dependency mock1; SubDependency mock2; { mock1.editABunchMoreStuff(); times = 0; mock2.notifyBeforeSave(); } }; }