Upgrade to AssertJ 3.25.0
This commit is contained in:
parent
a3c11fc033
commit
ffddbb586e
|
@ -109,7 +109,7 @@ dependencies {
|
||||||
api("org.aspectj:aspectjrt:1.9.21")
|
api("org.aspectj:aspectjrt:1.9.21")
|
||||||
api("org.aspectj:aspectjtools:1.9.21")
|
api("org.aspectj:aspectjtools:1.9.21")
|
||||||
api("org.aspectj:aspectjweaver:1.9.21")
|
api("org.aspectj:aspectjweaver:1.9.21")
|
||||||
api("org.assertj:assertj-core:3.24.2")
|
api("org.assertj:assertj-core:3.25.0")
|
||||||
api("org.awaitility:awaitility:4.2.0")
|
api("org.awaitility:awaitility:4.2.0")
|
||||||
api("org.bouncycastle:bcpkix-jdk18on:1.72")
|
api("org.bouncycastle:bcpkix-jdk18on:1.72")
|
||||||
api("org.codehaus.jettison:jettison:1.5.4")
|
api("org.codehaus.jettison:jettison:1.5.4")
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.assertj.core.api.InstanceOfAssertFactories;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.yaml.snakeyaml.composer.ComposerException;
|
import org.yaml.snakeyaml.composer.ComposerException;
|
||||||
import org.yaml.snakeyaml.parser.ParserException;
|
import org.yaml.snakeyaml.parser.ParserException;
|
||||||
|
@ -145,10 +146,11 @@ class YamlProcessorTests {
|
||||||
void standardTypesSupportedByDefault() {
|
void standardTypesSupportedByDefault() {
|
||||||
setYaml("value: !!set\n ? first\n ? second");
|
setYaml("value: !!set\n ? first\n ? second");
|
||||||
this.processor.process((properties, map) -> {
|
this.processor.process((properties, map) -> {
|
||||||
assertThat(properties).containsExactly(entry("value[0]", "first"), entry("value[1]", "second"));
|
// Assert on Properties as a Map due to bug in AssertJ 3.25.0
|
||||||
assertThat(map.get("value")).isInstanceOf(Set.class);
|
Map<Object, Object> propsAsMap = new LinkedHashMap<>(properties);
|
||||||
Set<String> set = (Set<String>) map.get("value");
|
assertThat(propsAsMap).containsExactly(entry("value[0]", "first"), entry("value[1]", "second"));
|
||||||
assertThat(set).containsExactly("first", "second");
|
assertThat(map.get("value")).asInstanceOf(InstanceOfAssertFactories.type(Set.class))
|
||||||
|
.satisfies(set -> assertThat(set).containsExactly("first", "second"));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -51,6 +51,7 @@ import org.springframework.util.LinkedMultiValueMap;
|
||||||
import org.springframework.util.MultiValueMap;
|
import org.springframework.util.MultiValueMap;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
import static org.assertj.core.api.InstanceOfAssertFactories.LIST;
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
import static org.mockito.Mockito.inOrder;
|
import static org.mockito.Mockito.inOrder;
|
||||||
|
@ -126,7 +127,7 @@ public class ImportSelectorTests {
|
||||||
ordered.verify(beanFactory).registerBeanDefinition(eq("d"), any());
|
ordered.verify(beanFactory).registerBeanDefinition(eq("d"), any());
|
||||||
assertThat(TestImportGroup.instancesCount.get()).isEqualTo(1);
|
assertThat(TestImportGroup.instancesCount.get()).isEqualTo(1);
|
||||||
assertThat(TestImportGroup.imports).hasSize(1);
|
assertThat(TestImportGroup.imports).hasSize(1);
|
||||||
assertThat(TestImportGroup.imports.values()).element(0).asList().hasSize(2);
|
assertThat(TestImportGroup.imports.values()).element(0).asInstanceOf(LIST).hasSize(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2022 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -19,6 +19,7 @@ package org.springframework.aot.agent;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
import org.assertj.core.api.ThrowableAssert.ThrowingCallableWithValue;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -63,7 +64,7 @@ class RecordedInvocationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void staticInvocationShouldThrowWhenGetInstance() {
|
void staticInvocationShouldThrowWhenGetInstance() {
|
||||||
assertThatThrownBy(staticInvocation::getInstance).isInstanceOf(IllegalStateException.class);
|
assertThatThrownBy((ThrowingCallableWithValue) staticInvocation::getInstance).isInstanceOf(IllegalStateException.class);
|
||||||
assertThatThrownBy(staticInvocation::getInstanceTypeReference).isInstanceOf(IllegalStateException.class);
|
assertThatThrownBy(staticInvocation::getInstanceTypeReference).isInstanceOf(IllegalStateException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -64,6 +64,7 @@ import org.springframework.web.testfixture.servlet.MockHttpServletRequest;
|
||||||
import org.springframework.web.testfixture.servlet.MockHttpServletResponse;
|
import org.springframework.web.testfixture.servlet.MockHttpServletResponse;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
import static org.assertj.core.api.InstanceOfAssertFactories.LIST;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test fixture with {@link ExceptionHandlerExceptionResolver}.
|
* Test fixture with {@link ExceptionHandlerExceptionResolver}.
|
||||||
|
@ -75,7 +76,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||||
* @author Rodolphe Lecocq
|
* @author Rodolphe Lecocq
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class ExceptionHandlerExceptionResolverTests {
|
class ExceptionHandlerExceptionResolverTests {
|
||||||
|
|
||||||
private static int DEFAULT_RESOLVER_COUNT;
|
private static int DEFAULT_RESOLVER_COUNT;
|
||||||
|
|
||||||
|
@ -89,7 +90,7 @@ public class ExceptionHandlerExceptionResolverTests {
|
||||||
|
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void setupOnce() {
|
static void setupOnce() {
|
||||||
ExceptionHandlerExceptionResolver resolver = new ExceptionHandlerExceptionResolver();
|
ExceptionHandlerExceptionResolver resolver = new ExceptionHandlerExceptionResolver();
|
||||||
resolver.afterPropertiesSet();
|
resolver.afterPropertiesSet();
|
||||||
DEFAULT_RESOLVER_COUNT = resolver.getArgumentResolvers().getResolvers().size();
|
DEFAULT_RESOLVER_COUNT = resolver.getArgumentResolvers().getResolvers().size();
|
||||||
|
@ -97,7 +98,7 @@ public class ExceptionHandlerExceptionResolverTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setup() throws Exception {
|
void setup() throws Exception {
|
||||||
this.resolver = new ExceptionHandlerExceptionResolver();
|
this.resolver = new ExceptionHandlerExceptionResolver();
|
||||||
this.resolver.setWarnLogCategory(this.resolver.getClass().getName());
|
this.resolver.setWarnLogCategory(this.resolver.getClass().getName());
|
||||||
this.request = new MockHttpServletRequest("GET", "/");
|
this.request = new MockHttpServletRequest("GET", "/");
|
||||||
|
@ -146,9 +147,9 @@ public class ExceptionHandlerExceptionResolverTests {
|
||||||
@Test
|
@Test
|
||||||
void setResponseBodyAdvice() {
|
void setResponseBodyAdvice() {
|
||||||
this.resolver.setResponseBodyAdvice(Collections.singletonList(new JsonViewResponseBodyAdvice()));
|
this.resolver.setResponseBodyAdvice(Collections.singletonList(new JsonViewResponseBodyAdvice()));
|
||||||
assertThat(this.resolver).extracting("responseBodyAdvice").asList().hasSize(1);
|
assertThat(this.resolver).extracting("responseBodyAdvice").asInstanceOf(LIST).hasSize(1);
|
||||||
this.resolver.setResponseBodyAdvice(Collections.singletonList(new CustomResponseBodyAdvice()));
|
this.resolver.setResponseBodyAdvice(Collections.singletonList(new CustomResponseBodyAdvice()));
|
||||||
assertThat(this.resolver).extracting("responseBodyAdvice").asList().hasSize(2);
|
assertThat(this.resolver).extracting("responseBodyAdvice").asInstanceOf(LIST).hasSize(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue