Spring cleaning: avoid deprecation warnings

This commit is contained in:
Sam Brannen
2024-02-23 12:36:50 +01:00
parent 122372c580
commit b0d08fe2d4
8 changed files with 17 additions and 11 deletions

View File

@@ -42,6 +42,7 @@ import org.springframework.util.MultiValueMap;
import static java.util.Map.entry;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.InstanceOfAssertFactories.LIST;
/**
* @author Juergen Hoeller
@@ -201,7 +202,7 @@ class BeanWrapperGenericsTests {
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("listOfLists[0][0]", 5);
assertThat(bw.getPropertyValue("listOfLists[0][0]")).isEqualTo(5);
assertThat(gb.getListOfLists()).singleElement().asList().containsExactly(5);
assertThat(gb.getListOfLists()).singleElement().asInstanceOf(LIST).containsExactly(5);
}
@Test
@@ -213,7 +214,7 @@ class BeanWrapperGenericsTests {
BeanWrapper bw = new BeanWrapperImpl(gb);
bw.setPropertyValue("listOfLists[0][0]", "5");
assertThat(bw.getPropertyValue("listOfLists[0][0]")).isEqualTo(5);
assertThat(gb.getListOfLists()).singleElement().asList().containsExactly(5);
assertThat(gb.getListOfLists()).singleElement().asInstanceOf(LIST).containsExactly(5);
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@ import org.springframework.lang.Nullable;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.assertj.core.api.Assertions.assertThatNoException;
import static org.assertj.core.api.InstanceOfAssertFactories.LIST;
import static org.mockito.Mockito.mock;
/**
@@ -123,7 +124,7 @@ class BeanDefinitionMethodGeneratorFactoryTests {
AotServices.factoriesAndBeans(springFactoriesLoader, beanFactory));
BeanDefinitionMethodGenerator methodGenerator = methodGeneratorFactory
.getBeanDefinitionMethodGenerator(registeredBean);
assertThat(methodGenerator).extracting("aotContributions").asList()
assertThat(methodGenerator).extracting("aotContributions").asInstanceOf(LIST)
.containsExactly(beanContribution, loaderContribution);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -64,6 +64,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.assertj.core.api.Assertions.entry;
import static org.assertj.core.api.InstanceOfAssertFactories.LIST;
import static org.mockito.Mockito.mock;
/**
@@ -375,7 +376,7 @@ class BeanInstanceSupplierTests {
RegisteredBean registerBean = source.registerBean(this.beanFactory);
AutowiredArguments arguments = source.getResolver().resolveArguments(registerBean);
assertThat(arguments.toArray()).hasSize(1);
assertThat(arguments.getObject(0)).isInstanceOf(List.class).asList()
assertThat(arguments.getObject(0)).isInstanceOf(List.class).asInstanceOf(LIST)
.containsExactly("1", "2");
}

View File

@@ -24,6 +24,7 @@ import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.assertj.core.api.InstanceOfAssertFactories.LIST;
/**
* Tests for {@link CustomCollectionEditor}.
@@ -60,7 +61,7 @@ class CustomCollectionEditorTests {
Object value = editor.getValue();
assertThat(value).isNotNull();
assertThat(value).isInstanceOf(ArrayList.class);
assertThat(value).asList().containsExactly(0, 1, 2);
assertThat(value).asInstanceOf(LIST).containsExactly(0, 1, 2);
}
@Test