Skip to content

Commit

Permalink
Misc. code cleanup (#697)
Browse files Browse the repository at this point in the history
* Remove Lombok Sl4j annotation in classes that don't use the Logger
  (KillTimeoutAction, CidrRange, and KiwiPagingTest)
* Remove unused private constant from EndpointConfiguration
* Use GenericType in KiwiStandardResponsesIntegrationTest when reading
   the response entity, which makes the unchecked warning
   suppression unnecessary
* Replace deprecated AssertJ usingElementComparatorOnFields with
  usingRecursiveFieldByFieldElementComparatorOnFields
* Add an unused warning suppression to one of the classes inside
  KiwiReflectionTest, because the fields are never accessed directly
  or via reflection (the test is asking for non-static fields)
  • Loading branch information
sleberknight authored Apr 9, 2022
1 parent bbb58bb commit d86741a
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package org.kiwiproject.base.process;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;

/**
* Possible actions to take if a kill command times out.
*
* @see Processes#kill(long, KillSignal, long, TimeUnit, KillTimeoutAction)
*/
@Slf4j
public enum KillTimeoutAction {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
@Setter
public class EndpointConfiguration {

private static final String DOMAIN_SPLIT_CHAR = ",";

/**
* Use this to uniquely identify an endpoint within a {@link SecureEndpointsConfiguration}, or to provide
* a way to find an {@link EndpointConfiguration} in any collection of them, e.g. using a
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/org/kiwiproject/net/CidrRange.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package org.kiwiproject.net;

import com.google.common.net.InetAddresses;
import lombok.extern.slf4j.Slf4j;

import java.math.BigInteger;
import java.net.InetAddress;
import java.nio.ByteBuffer;
Expand All @@ -15,7 +13,6 @@
* updated since 2019 and seems to be unmaintained.
*/
@SuppressWarnings("UnstableApiUsage")
@Slf4j
public class CidrRange {

private final InetAddress inetAddress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.net.URI;
Expand Down Expand Up @@ -203,9 +204,8 @@ void shouldAccept() {
}

private static void assertResponseEntityMapHasErrorsKey(Response response) {
var entity = response.readEntity(Map.class);
var entity = response.readEntity(new GenericType<Map<String, Object>>() {});

//noinspection unchecked
assertThat(entity).containsKey("errors");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ void shouldDeserializeJson_ToSpecificType_WhenGivenValidInput() {
});

assertThat(people)
.usingElementComparatorOnFields("firstName", "lastName", "age")
.usingRecursiveFieldByFieldElementComparatorOnFields("firstName", "lastName", "age")
.containsOnlyOnce(
new Person("Bob", "Smith", 34),
new Person("Jason", "Whatever", 27)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,7 @@ static class Employee extends Person {
private final String title;
}

@SuppressWarnings("unused") // fields are not used
@AllArgsConstructor
@Getter
static class NoFieldObj {
Expand Down
2 changes: 0 additions & 2 deletions src/test/java/org/kiwiproject/spring/data/KiwiPagingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import static org.kiwiproject.collect.KiwiLists.second;

import com.google.common.collect.Streams;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
Expand All @@ -24,7 +23,6 @@
import java.util.List;

@DisplayName("KiwiPaging")
@Slf4j
class KiwiPagingTest {

@Nested
Expand Down

0 comments on commit d86741a

Please sign in to comment.