📍Use lombok, reformat, and optimize the code (#1560)
* Use lombok, reformat, and optimize the code * Fix merge conflicts and some sonar issues Co-authored-by: va1m <va1m@email.com>
This commit is contained in:
@ -23,17 +23,15 @@
|
||||
|
||||
package com.iluwatar.monostate;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* The Server class. Each Server sits behind a LoadBalancer which delegates the call to the servers
|
||||
* in a simplistic Round Robin fashion.
|
||||
*/
|
||||
@Slf4j
|
||||
public class Server {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(Server.class);
|
||||
|
||||
public final String host;
|
||||
public final int port;
|
||||
public final int id;
|
||||
|
@ -31,7 +31,7 @@ import org.junit.jupiter.api.Test;
|
||||
public class AppTest {
|
||||
|
||||
@Test
|
||||
public void testMain() {
|
||||
void testMain() {
|
||||
App.main(new String[]{});
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ import org.junit.jupiter.api.Test;
|
||||
public class LoadBalancerTest {
|
||||
|
||||
@Test
|
||||
public void testSameStateAmongstAllInstances() {
|
||||
void testSameStateAmongstAllInstances() {
|
||||
final var firstBalancer = new LoadBalancer();
|
||||
final var secondBalancer = new LoadBalancer();
|
||||
firstBalancer.addServer(new Server("localhost", 8085, 6));
|
||||
@ -54,7 +54,7 @@ public class LoadBalancerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testServe() {
|
||||
void testServe() {
|
||||
final var server = mock(Server.class);
|
||||
when(server.getHost()).thenReturn("testhost");
|
||||
when(server.getPort()).thenReturn(1234);
|
||||
|
Reference in New Issue
Block a user