我有一个自定义 Binder :
@BindingAnnotation(CustomBinder.CustomBinderFactory.class)
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.PARAMETER })
public @interface CustomBinder {
class CustomBinderFactory implements BinderFactory<CustomBinder> {
@Override
public Binder<CustomBinder, Entity> build(CustomBinder annotation) {
return (q, bind, arg) -> {
// implement
};
}
}
}
我想为此编写一个单元测试;我该怎么做?
最佳答案
嗯,这要看情况。首先,您可以编写一个简单的 jUnit 测试和模拟(或者最好是实例化)CustomBinder
类。
如果您想添加编写集成测试,您的集成测试可能会使用此注释 - 并且您可以断言结果。
但我会从一个简单的单元测试开始。看看这篇文章:https://www.baeldung.com/java-custom-annotation
关于java - 如何测试jdbi BinderFactory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60065920/