Remove duplicated file
This commit is contained in:
parent
463f5256c0
commit
71e40aa4f5
|
@ -1,57 +0,0 @@
|
|||
package org.baeldung.mocks.jmockit;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import mockit.Expectations;
|
||||
import mockit.Injectable;
|
||||
import mockit.Mocked;
|
||||
import mockit.Tested;
|
||||
import mockit.Verifications;
|
||||
import mockit.integration.junit4.JMockit;
|
||||
|
||||
@RunWith(JMockit.class)
|
||||
public class ReusingTest {
|
||||
|
||||
@Injectable
|
||||
private Collaborator collaborator;
|
||||
|
||||
@Mocked
|
||||
private Model model;
|
||||
|
||||
@Tested
|
||||
private Performer performer;
|
||||
|
||||
@Before
|
||||
public void setup(){
|
||||
new Expectations(){{
|
||||
model.getInfo(); result = "foo"; minTimes = 0;
|
||||
collaborator.collaborate("foo"); result = true; minTimes = 0;
|
||||
}};
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithSetup() {
|
||||
performer.perform(model);
|
||||
verifyTrueCalls(1);
|
||||
}
|
||||
|
||||
protected void verifyTrueCalls(int calls){
|
||||
new Verifications(){{
|
||||
collaborator.receive(true); times = calls;
|
||||
}};
|
||||
}
|
||||
|
||||
final class TrueCallsVerification extends Verifications{
|
||||
public TrueCallsVerification(int calls){
|
||||
collaborator.receive(true); times = calls;
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithFinalClass() {
|
||||
performer.perform(model);
|
||||
new TrueCallsVerification(1);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue