-
Notifications
You must be signed in to change notification settings - Fork 307
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
被测类:
public String process(String source) {
List<Function<String, String>> processChain = new ArrayList<>();
processChain.add(this::function1);
processChain.add(this::function2);
String temp = source;
for(Function<String, String> f : processChain) {
temp = f.apply(temp);
}
return temp;
}
private String function1(String source) {
return "*" + source;
}
private String function2(String source) {
return "#" + source;
}
public String process2(String source) {
return function2(function1(source));
}test:
private DemoLambada demoLambada = new DemoLambada();
@MockMethod(targetClass = DemoLambada.class)
private String function1(String source) {
return "mock1" + source;
}
@MockMethod(targetClass = DemoLambada.class)
private String function2(String source) {
return "mock2" + source;
}
// 不通过
@Test
public void test_process() {
Assertions.assertEquals("mock2mock1s", demoLambada.process("s"));
}
@Test
public void test_process2() {
System.out.println(demoLambada.process2("s"));
Assertions.assertEquals("mock2mock1s", demoLambada.process2("s"));
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request