Skip to content
Permalink
Browse files

[SMALLFIX]Use static imports for standard test utilities

change import org.junit.Assert to import static
org.junit.Assert.assertEquals, import static
org.junit.Assert.assertFalse, import static org.junit.Assert.assertTrue,
import static org.junit.Assert.assertNull;
change Assert.{{method}}* to {{method}}*

pr-link: #9064
change-id: cid-c284c142251539c1b1258816a891021f53261017
  • Loading branch information...
MelonRind authored and alluxio-bot committed May 14, 2019
1 parent 35c07fb commit 3c02e2d14724ccdca6fa38e20715c4411ab607d0
Showing with 16 additions and 13 deletions.
  1. +16 −13 core/client/fs/src/test/java/alluxio/client/block/stream/GrpcBlockingStreamTest.java
@@ -12,6 +12,10 @@
package alluxio.client.block.stream;

import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNull;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doAnswer;
@@ -31,7 +35,6 @@
import io.grpc.stub.ClientCallStreamObserver;
import io.grpc.stub.ClientResponseObserver;
import io.grpc.stub.StreamObserver;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -99,7 +102,7 @@ public void receive() throws Exception {

WriteResponse actualResponse = mStream.receive(TIMEOUT);

Assert.assertEquals(response, actualResponse);
assertEquals(response, actualResponse);
}

/**
@@ -109,8 +112,8 @@ public void receive() throws Exception {
public void close() throws Exception {
mStream.close();

Assert.assertTrue(mStream.isClosed());
Assert.assertFalse(mStream.isOpen());
assertTrue(mStream.isClosed());
assertFalse(mStream.isOpen());
verify(mRequestObserver).onCompleted();
}

@@ -121,8 +124,8 @@ public void close() throws Exception {
public void cancel() throws Exception {
mStream.cancel();

Assert.assertTrue(mStream.isCanceled());
Assert.assertFalse(mStream.isOpen());
assertTrue(mStream.isCanceled());
assertFalse(mStream.isOpen());
verify(mRequestObserver).cancel(any(String.class), eq(null));
}

@@ -134,7 +137,7 @@ public void onCompleted() throws Exception {
mResponseObserver.onCompleted();

WriteResponse actualResponse = mStream.receive(TIMEOUT);
Assert.assertNull(actualResponse);
assertNull(actualResponse);
}

/**
@@ -266,7 +269,7 @@ public void receiveAfterResponseArrives() throws Exception {

WriteResponse actualResponse = mStream.receive(TIMEOUT);

Assert.assertEquals(response, actualResponse);
assertEquals(response, actualResponse);
}

/**
@@ -286,7 +289,7 @@ public void receiveMoreThanBufferSize() throws Exception {

for (WriteResponse response : responses) {
WriteResponse actualResponse = mStream.receive(TIMEOUT);
Assert.assertEquals(response, actualResponse);
assertEquals(response, actualResponse);
}
}

@@ -306,7 +309,7 @@ public void receiveErrorWhenBufferFull() throws Exception {

for (WriteResponse response : responses) {
WriteResponse actualResponse = mStream.receive(TIMEOUT);
Assert.assertEquals(response, actualResponse);
assertEquals(response, actualResponse);
}
}

@@ -331,12 +334,12 @@ public void waitForComplete() throws Exception {
});

WriteResponse actualResponse = mStream.receive(TIMEOUT);
Assert.assertEquals(responses[0], actualResponse);
assertEquals(responses[0], actualResponse);

mStream.waitForComplete(TIMEOUT);

actualResponse = mStream.receive(TIMEOUT);
Assert.assertEquals(null, actualResponse);
assertEquals(null, actualResponse);
}

/**
@@ -360,7 +363,7 @@ public void waitForCompleteTimeout() throws Exception {
});

WriteResponse actualResponse = mStream.receive(SHORT_TIMEOUT);
Assert.assertEquals(responses[0], actualResponse);
assertEquals(responses[0], actualResponse);
mThrown.expect(DeadlineExceededException.class);
mThrown.expectMessage(containsString(TEST_MESSAGE));

0 comments on commit 3c02e2d

Please sign in to comment.
You can’t perform that action at this time.