📍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:
@ -68,8 +68,8 @@ public enum RequestType {
|
||||
Then the request handler hierarchy
|
||||
|
||||
```java
|
||||
@Slf4j
|
||||
public abstract class RequestHandler {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(RequestHandler.class);
|
||||
private final RequestHandler next;
|
||||
|
||||
public RequestHandler(RequestHandler next) {
|
||||
|
@ -47,6 +47,5 @@ public class App {
|
||||
king.makeRequest(new Request(RequestType.DEFEND_CASTLE, "defend castle"));
|
||||
king.makeRequest(new Request(RequestType.TORTURE_PRISONER, "torture prisoner"));
|
||||
king.makeRequest(new Request(RequestType.COLLECT_TAX, "collect tax"));
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -23,22 +23,18 @@
|
||||
|
||||
package com.iluwatar.chain;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* RequestHandler.
|
||||
*/
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public abstract class RequestHandler {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(RequestHandler.class);
|
||||
|
||||
private final RequestHandler next;
|
||||
|
||||
public RequestHandler(RequestHandler next) {
|
||||
this.next = next;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request handler.
|
||||
*/
|
||||
|
@ -28,6 +28,8 @@ package com.iluwatar.chain;
|
||||
*/
|
||||
public enum RequestType {
|
||||
|
||||
DEFEND_CASTLE, TORTURE_PRISONER, COLLECT_TAX
|
||||
DEFEND_CASTLE,
|
||||
TORTURE_PRISONER,
|
||||
COLLECT_TAX
|
||||
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ import org.junit.jupiter.api.Test;
|
||||
*
|
||||
* @author Jeroen Meulemeester
|
||||
*/
|
||||
public class OrcKingTest {
|
||||
class OrcKingTest {
|
||||
|
||||
/**
|
||||
* All possible requests
|
||||
@ -45,7 +45,7 @@ public class OrcKingTest {
|
||||
);
|
||||
|
||||
@Test
|
||||
public void testMakeRequest() {
|
||||
void testMakeRequest() {
|
||||
final var king = new OrcKing();
|
||||
|
||||
REQUESTS.forEach(request -> {
|
||||
|
Reference in New Issue
Block a user