Skip to content

Commit

Permalink
Warnings clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Nov 9, 2024
1 parent 2d67b15 commit d1a8e71
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@

// [databind#4639] 2.18.1 : regression when using @JsonAnySetter outside of @JsonCreator
public class AnySetterFieldWithCreator4639Test
extends DatabindTestUtil
extends DatabindTestUtil
{

public static class Bean {
private int b;
private int d;
int b;
int d;

@JsonAnySetter
private Map<String, ?> any;
Map<String, ?> any;

@JsonCreator
public Bean(@JsonProperty("b") int b, @JsonProperty("d") int d) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class SingleImmutableFieldCreatorTest
extends DatabindTestUtil
{
static class ImmutableId {
private final int id;
final int id;

public ImmutableId(int id) { this.id = id; }

Expand All @@ -28,7 +28,7 @@ public int getId() {
}

static class ImmutableIdWithEmptyConstuctor {
private final int id;
final int id;

public ImmutableIdWithEmptyConstuctor() { this(-1); }

Expand All @@ -40,7 +40,7 @@ public int getId() {
}

static class ImmutableIdWithJsonCreatorAnnotation {
private final int id;
final int id;

@JsonCreator
public ImmutableIdWithJsonCreatorAnnotation(int id) { this.id = id; }
Expand All @@ -51,7 +51,8 @@ public int getId() {
}

static class ImmutableIdWithJsonPropertyFieldAnnotation {
@JsonProperty("id") private final int id;
@JsonProperty("id")
final int id;

public ImmutableIdWithJsonPropertyFieldAnnotation(int id) { this.id = id; }

Expand All @@ -61,7 +62,7 @@ public int getId() {
}

static class ImmutableIdWithJsonPropertyConstructorAnnotation {
private final int id;
final int id;

public ImmutableIdWithJsonPropertyConstructorAnnotation(@JsonProperty("id") int id) { this.id = id; }

Expand Down
13 changes: 6 additions & 7 deletions src/test/java/com/fasterxml/jackson/databind/ser/TestConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,16 @@ public void testProviderConfig() throws Exception
DefaultSerializerProvider prov = (DefaultSerializerProvider) mapper.getSerializerProvider();
assertEquals(0, prov.cachedSerializersCount());
// and then should get one constructed for:
Map<String,Object> result = this.writeAndMap(mapper, new AnnoBean());
Map<String,Object> result = writeAndMap(mapper, new AnnoBean());
assertEquals(2, result.size());
assertEquals(Integer.valueOf(1), result.get("x"));
assertEquals(Integer.valueOf(2), result.get("y"));

/* Note: it is 2 because we'll also get serializer for basic 'int', not
* just AnnoBean
*/
/* 12-Jan-2010, tatus: Actually, probably more, if and when we typing
* aspects are considered (depending on what is cached)
*/
// Note: it is 2 because we'll also get serializer for basic 'int', not
// just AnnoBean

// 12-Jan-2010, tatus: Actually, probably more, if and when we typing
// aspects are considered (depending on what is cached)
int count = prov.cachedSerializersCount();
if (count < 2) {
fail("Should have at least 2 cached serializers, got "+count);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.fasterxml.jackson.databind.testutil.failure;

import java.lang.reflect.Method;

import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.InvocationInterceptor;
import org.junit.jupiter.api.extension.ReflectiveInvocationContext;

import java.lang.reflect.Method;
import java.util.List;

/**
* Custom {@link InvocationInterceptor} that intercepts test method invocation.
* To pass the test ***only if*** test fails with an exception, and fail the test otherwise.
Expand All @@ -16,11 +15,11 @@
public class JacksonTestFailureExpectedInterceptor
implements InvocationInterceptor
{

@Override
public void interceptTestMethod(Invocation<Void> invocation,
ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext)
throws Throwable {
ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext)
throws Throwable
{
try {
invocation.proceed();
} catch (Throwable t) {
Expand All @@ -34,7 +33,7 @@ private void handleUnexpectePassingTest(ReflectiveInvocationContext<Method> invo
// Collect information we need
Object targetClass = invocationContext.getTargetClass();
Object testMethod = invocationContext.getExecutable().getName();
List<Object> arguments = invocationContext.getArguments();
//List<Object> arguments = invocationContext.getArguments();

// Create message
String message = String.format("Test method %s.%s() passed, but should have failed", targetClass, testMethod);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
public class JacksonTestShouldFailException
extends RuntimeException
{
private static final long serialVersionUID = 1L;

public JacksonTestShouldFailException(String msg) {
super(msg);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
// [databind#4742] Deserialization with Builder, External type id,
// @JsonCreator not yet implemented
public class JacksonBuilderCreatorSubtype4742Test
extends DatabindTestUtil
extends DatabindTestUtil
{

public static class Animals {
@JsonProperty("animals")
public List<Animal> animals;
Expand Down Expand Up @@ -64,11 +63,13 @@ public static class BuilderImpl extends Builder {
private String kind;
private AnimalProperties properties;

@Override
public BuilderImpl kind(String kind) {
this.kind = kind;
return this;
}

@Override
public BuilderImpl properties(AnimalProperties properties) {
this.properties = properties;
return this;
Expand Down Expand Up @@ -107,12 +108,11 @@ public String toString() {
}
}

final ObjectMapper MAPPER = newJsonMapper();
private final ObjectMapper MAPPER = newJsonMapper();

@JacksonTestFailureExpected
@Test
public void testDeser()
throws Exception
public void testDeser() throws Exception
{
final Animals animals = MAPPER.readValue(
"{\n" +
Expand Down

0 comments on commit d1a8e71

Please sign in to comment.