mirror of https://github.com/grpc/grpc-java.git
test: stop mocking Executor. (#10199)
It is forbidden internally. Error message: Mocking types which have complex contracts or are easy to construct by other means is forbidden: 'executor' is mocking 'interface java.util.concurrent.Executor'. Use a real executor. Mocks of Executor don't execute submitted tasks at all, which leads to suppressed errors, deadlocks, and brittle tests..
This commit is contained in:
parent
5d40396aa2
commit
6fd93486cc
|
|
@ -77,11 +77,16 @@ public final class CronetClientStreamTest {
|
|||
private Metadata metadata = new Metadata();
|
||||
@Mock private StreamBuilderFactory factory;
|
||||
@Mock private ExperimentalBidirectionalStream cronetStream;
|
||||
@Mock private Executor executor;
|
||||
@Mock private ClientStreamListener clientListener;
|
||||
@Mock private ExperimentalBidirectionalStream.Builder builder;
|
||||
private final Object lock = new Object();
|
||||
private final TransportTracer transportTracer = TransportTracer.getDefaultFactory().create();
|
||||
private final Executor executor = new Executor() {
|
||||
@Override
|
||||
public void execute(Runnable r) {
|
||||
r.run();
|
||||
}
|
||||
};
|
||||
CronetClientStream clientStream;
|
||||
|
||||
private MethodDescriptor.Marshaller<Void> marshaller = TestMethodDescriptors.voidMarshaller();
|
||||
|
|
|
|||
|
|
@ -68,10 +68,15 @@ public final class CronetClientTransportTest {
|
|||
new ClientStreamTracer[]{ new ClientStreamTracer() {} };
|
||||
private CronetClientTransport transport;
|
||||
@Mock private StreamBuilderFactory streamFactory;
|
||||
@Mock private Executor executor;
|
||||
private MethodDescriptor<Void, Void> descriptor = TestMethodDescriptors.voidMethod();
|
||||
@Mock private ManagedClientTransport.Listener clientTransportListener;
|
||||
@Mock private BidirectionalStream.Builder builder;
|
||||
private final Executor executor = new Executor() {
|
||||
@Override
|
||||
public void execute(Runnable r) {
|
||||
r.run();
|
||||
}
|
||||
};
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue