Örnek... the annotation itself does not prevent production code from calling the annotated method
Şöyle yaparız. Böylece testler farklı bir pakette olsa bile Bar sınıfına erişebilir
class Foo {
...
@VisibleForTesting
static class Bar {
}
}
Örnek... the annotation itself does not prevent production code from calling the annotated method
class Foo {
...
@VisibleForTesting
static class Bar {
}
}
import com.google.common.util.concurrent.ServiceManager;
public class ManagedGuavaServices implements Managed {
@Inject
private ServiceManager serviceManager;
@Inject
public ManagedGuavaServices(ServiceManager serviceManager) {
this.serviceManager = serviceManager;
}
@Override
public void start() throws Exception {
serviceManager.startAsync();
serviceManager.awaitHealthy(2, TimeUnit.SECONDS);
}
@Override
public void stop() throws Exception {
serviceManager.stopAsync();
serviceManager.awaitStopped(2, TimeUnit.SECONDS);
}
}