云
7 小时以前 3ff6604c75c887f4056ee03545d204bc9323286c
yudao-module-mes/src/test/java/cn/iocoder/yudao/module/mes/service/pro/task/schedule/MesProBatchScheduleServiceTest.java
@@ -188,7 +188,17 @@
    }
    private static <T> T stub(Class<T> type, InvocationHandler handler) {
        return type.cast(Proxy.newProxyInstance(type.getClassLoader(), new Class<?>[]{type}, handler));
        return type.cast(Proxy.newProxyInstance(type.getClassLoader(), new Class<?>[]{type}, (proxy, method, args) -> {
            if (method.getDeclaringClass() == Object.class) {
                return switch (method.getName()) {
                    case "toString" -> type.getSimpleName() + "Stub";
                    case "hashCode" -> System.identityHashCode(proxy);
                    case "equals" -> proxy == args[0];
                    default -> throw new AssertionError(method.getName());
                };
            }
            return handler.invoke(proxy, method, args);
        }));
    }
    static class Fixture {