Polish "Return consistent collection type for matrix variables"

See gh-31483
This commit is contained in:
Stéphane Nicoll
2023-10-24 10:49:41 +02:00
parent ea30c8fb5b
commit 9aa707ec4b
4 changed files with 42 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2023 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.
@@ -22,6 +22,7 @@ import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import org.assertj.core.api.InstanceOfAssertFactories;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -139,6 +140,19 @@ public class MatrixVariablesMapMethodArgumentResolverTests {
assertThat(mapAll.get("colors")).isEqualTo("red");
}
@Test
public void resolveMultiValueMapArgumentNoParams() {
MethodParameter param = this.testMethod.annot(matrixAttribute().noPathVar())
.arg(MultiValueMap.class, String.class, String.class);
Object result = this.resolver.resolveArgument(param,
new BindingContext(), this.exchange).block(Duration.ZERO);
assertThat(result).isInstanceOf(MultiValueMap.class)
.asInstanceOf(InstanceOfAssertFactories.MAP).isEmpty();
}
@Test
public void resolveArgumentNoParams() throws Exception {