Skip to content

Commit

Permalink
Spotless
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Carbonetto <[email protected]>
  • Loading branch information
acarbonetto committed Mar 26, 2024
1 parent 8db59c3 commit b5feb10
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
3 changes: 2 additions & 1 deletion java/client/src/test/java/glide/api/RedisClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ public void set_returns_success() {
String value = "testValue";
CompletableFuture<String> testResponse = new CompletableFuture<>();
testResponse.complete(null);
when(commandManager.<String>submitNewCommand(eq(SetString), eq(new String[] {key, value}), any()))
when(commandManager.<String>submitNewCommand(
eq(SetString), eq(new String[] {key, value}), any()))
.thenReturn(testResponse);

// exercise
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ public void rethrow_error_on_read_when_malformed_packet_received() {
@Test
@SneakyThrows
public void rethrow_error_if_UDS_channel_closed() {
try(var client = new TestClient(channelHandler)) {
try (var client = new TestClient(channelHandler)) {
stopRustCoreLibMock();
try {
var exception =
assertThrows(ExecutionException.class, () -> client.customCommand(new String[0]).get());
assertThrows(ExecutionException.class, () -> client.customCommand(new String[0]).get());
assertTrue(exception.getCause() instanceof ClosingException);
} finally {
// restart mock to let other tests pass if this one failed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public void getOrCreate_returns_default_after_repeated_calls() {
assertEquals(mockedThreadPoolResource, theResource);

// Ensure that supplier only is invoked once to set up the shared resource
ThreadPoolResource theSameResource = ThreadPoolResourceAllocator.getOrCreate(threadPoolSupplier);
ThreadPoolResource theSameResource =
ThreadPoolResourceAllocator.getOrCreate(threadPoolSupplier);
assertEquals(mockedThreadPoolResource, theSameResource);
verify(threadPoolSupplier, times(1)).get();

Expand All @@ -63,7 +64,8 @@ public void getOrCreate_returns_new_thread_pool_after_shutdown() {
assertEquals(mockedThreadPoolResource, theResource);

// Ensure that supplier only is invoked once to set up the shared resource
ThreadPoolResource theSameResource = ThreadPoolResourceAllocator.getOrCreate(threadPoolSupplier);
ThreadPoolResource theSameResource =
ThreadPoolResourceAllocator.getOrCreate(threadPoolSupplier);
assertEquals(mockedThreadPoolResource, theSameResource);
verify(threadPoolSupplier, times(2)).get();

Expand Down
20 changes: 10 additions & 10 deletions java/client/src/test/java/glide/managers/ConnectionManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,21 @@ public class ConnectionManagerTest {

ChannelHandler channel;

private final static String HOST = "aws.com";
private final static int PORT = 9999;
private static final String HOST = "aws.com";
private static final int PORT = 9999;

private final static String USERNAME = "JohnDoe";
private final static String PASSWORD = "Password1";
private static final String USERNAME = "JohnDoe";
private static final String PASSWORD = "Password1";

private final static int NUM_OF_RETRIES = 5;
private final static int FACTOR = 10;
private final static int EXPONENT_BASE = 50;
private static final int NUM_OF_RETRIES = 5;
private static final int FACTOR = 10;
private static final int EXPONENT_BASE = 50;

private final static int DATABASE_ID = 1;
private static final int DATABASE_ID = 1;

private final static int REQUEST_TIMEOUT = 3;
private static final int REQUEST_TIMEOUT = 3;

private final static String CLIENT_NAME = "ClientName";
private static final String CLIENT_NAME = "ClientName";

@BeforeEach
public void setUp() {
Expand Down
3 changes: 2 additions & 1 deletion java/client/src/test/java/glide/utils/RustCoreMock.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ private class UdsServer extends ChannelInboundHandlerAdapter {
private final AtomicBoolean anybodyConnected = new AtomicBoolean(false);

@Override
public void channelRead(@NonNull ChannelHandlerContext ctx, @NonNull Object msg) throws Exception {
public void channelRead(@NonNull ChannelHandlerContext ctx, @NonNull Object msg)
throws Exception {
var buf = (ByteBuf) msg;
var bytes = new byte[buf.readableBytes()];
buf.readBytes(bytes);
Expand Down

0 comments on commit b5feb10

Please sign in to comment.