Browse Source

Add nullability annotations to tests in module/spring-boot-gson

See gh-47263
pull/47415/head
Moritz Halbritter 3 months ago
parent
commit
80436abbb6
  1. 4
      module/spring-boot-gson/build.gradle
  2. 3
      module/spring-boot-gson/src/test/java/org/springframework/boot/gson/autoconfigure/Gson210AutoConfigurationTests.java
  3. 3
      module/spring-boot-gson/src/test/java/org/springframework/boot/gson/autoconfigure/GsonAutoConfigurationTests.java

4
module/spring-boot-gson/build.gradle

@ -36,3 +36,7 @@ dependencies { @@ -36,3 +36,7 @@ dependencies {
testRuntimeOnly("ch.qos.logback:logback-classic")
}
tasks.named("compileTestJava") {
options.nullability.checking = "tests"
}

3
module/spring-boot-gson/src/test/java/org/springframework/boot/gson/autoconfigure/Gson210AutoConfigurationTests.java

@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
package org.springframework.boot.gson.autoconfigure;
import com.google.gson.Gson;
import org.jspecify.annotations.Nullable;
import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.AutoConfigurations;
@ -52,7 +53,7 @@ class Gson210AutoConfigurationTests { @@ -52,7 +53,7 @@ class Gson210AutoConfigurationTests {
private Long data = 1L;
@SuppressWarnings("unused")
private final String owner = null;
private final @Nullable String owner = null;
public void setData(Long data) {
this.data = data;

3
module/spring-boot-gson/src/test/java/org/springframework/boot/gson/autoconfigure/GsonAutoConfigurationTests.java

@ -29,6 +29,7 @@ import com.google.gson.Gson; @@ -29,6 +29,7 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.LongSerializationPolicy;
import com.google.gson.Strictness;
import org.jspecify.annotations.Nullable;
import org.junit.jupiter.api.Test;
import org.skyscreamer.jsonassert.JSONAssert;
@ -310,7 +311,7 @@ class GsonAutoConfigurationTests { @@ -310,7 +311,7 @@ class GsonAutoConfigurationTests {
private Long data = 1L;
@SuppressWarnings("unused")
private final String owner = null;
private final @Nullable String owner = null;
public void setData(Long data) {
this.data = data;

Loading…
Cancel
Save