Align with breaking API change in AssertJ 3.12
Closes gh-16145
This commit is contained in:
parent
c2e9f98655
commit
87d696d697
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
* Copyright 2012-2019 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.
|
||||
|
|
@ -101,7 +101,7 @@ public class ValidationErrorsTests {
|
|||
allErrors.add(new ObjectError("foo", "bar"));
|
||||
ValidationErrors errors = new ValidationErrors(NAME, Collections.emptySet(),
|
||||
allErrors);
|
||||
assertThat(errors.iterator()).containsExactlyElementsOf(allErrors);
|
||||
assertThat(errors.iterator()).toIterable().containsExactlyElementsOf(allErrors);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
* Copyright 2012-2019 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.
|
||||
|
|
@ -127,7 +127,7 @@ public class ConfigurationPropertySourcesTests {
|
|||
new MapPropertySource("baz", Collections.singletonMap("baz", "barf")));
|
||||
Iterable<ConfigurationPropertySource> configurationSources = ConfigurationPropertySources
|
||||
.from(sources);
|
||||
assertThat(configurationSources.iterator()).hasSize(5);
|
||||
assertThat(configurationSources.iterator()).toIterable().hasSize(5);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2019 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.
|
||||
|
|
@ -35,33 +35,45 @@ public class DefaultPropertyMapperTests extends AbstractPropertyMapperTests {
|
|||
|
||||
@Test
|
||||
public void mapFromStringShouldReturnBestGuess() {
|
||||
assertThat(namesFromString("server")).containsExactly("server");
|
||||
assertThat(namesFromString("server.port")).containsExactly("server.port");
|
||||
assertThat(namesFromString("host[0]")).containsExactly("host[0]");
|
||||
assertThat(namesFromString("host[0][1]")).containsExactly("host[0][1]");
|
||||
assertThat(namesFromString("host[0].name")).containsExactly("host[0].name");
|
||||
assertThat(namesFromString("host.f00.name")).containsExactly("host.f00.name");
|
||||
assertThat(namesFromString("my.host-name")).containsExactly("my.host-name");
|
||||
assertThat(namesFromString("my.hostName")).containsExactly("my.hostname");
|
||||
assertThat(namesFromString("my.HOST_NAME")).containsExactly("my.hostname");
|
||||
assertThat(namesFromString("s[!@#$%^&*()=+]e-rVeR"))
|
||||
assertThat(namesFromString("server")).toIterable().containsExactly("server");
|
||||
assertThat(namesFromString("server.port")).toIterable()
|
||||
.containsExactly("server.port");
|
||||
assertThat(namesFromString("host[0]")).toIterable().containsExactly("host[0]");
|
||||
assertThat(namesFromString("host[0][1]")).toIterable()
|
||||
.containsExactly("host[0][1]");
|
||||
assertThat(namesFromString("host[0].name")).toIterable()
|
||||
.containsExactly("host[0].name");
|
||||
assertThat(namesFromString("host.f00.name")).toIterable()
|
||||
.containsExactly("host.f00.name");
|
||||
assertThat(namesFromString("my.host-name")).toIterable()
|
||||
.containsExactly("my.host-name");
|
||||
assertThat(namesFromString("my.hostName")).toIterable()
|
||||
.containsExactly("my.hostname");
|
||||
assertThat(namesFromString("my.HOST_NAME")).toIterable()
|
||||
.containsExactly("my.hostname");
|
||||
assertThat(namesFromString("s[!@#$%^&*()=+]e-rVeR")).toIterable()
|
||||
.containsExactly("s[!@#$%^&*()=+].e-rver");
|
||||
assertThat(namesFromString("host[FOO].name")).containsExactly("host[FOO].name");
|
||||
assertThat(namesFromString("host[FOO].name")).toIterable()
|
||||
.containsExactly("host[FOO].name");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mapFromConfigurationShouldReturnBestGuess() {
|
||||
assertThat(namesFromConfiguration("server")).containsExactly("server");
|
||||
assertThat(namesFromConfiguration("server.port")).containsExactly("server.port");
|
||||
assertThat(namesFromConfiguration("host[0]")).containsExactly("host[0]");
|
||||
assertThat(namesFromConfiguration("host[0][1]")).containsExactly("host[0][1]");
|
||||
assertThat(namesFromConfiguration("host[0].name"))
|
||||
assertThat(namesFromConfiguration("server")).toIterable()
|
||||
.containsExactly("server");
|
||||
assertThat(namesFromConfiguration("server.port")).toIterable()
|
||||
.containsExactly("server.port");
|
||||
assertThat(namesFromConfiguration("host[0]")).toIterable()
|
||||
.containsExactly("host[0]");
|
||||
assertThat(namesFromConfiguration("host[0][1]")).toIterable()
|
||||
.containsExactly("host[0][1]");
|
||||
assertThat(namesFromConfiguration("host[0].name")).toIterable()
|
||||
.containsExactly("host[0].name");
|
||||
assertThat(namesFromConfiguration("host.f00.name"))
|
||||
assertThat(namesFromConfiguration("host.f00.name")).toIterable()
|
||||
.containsExactly("host.f00.name");
|
||||
assertThat(namesFromConfiguration("my.host-name"))
|
||||
assertThat(namesFromConfiguration("my.host-name")).toIterable()
|
||||
.containsExactly("my.host-name");
|
||||
assertThat(namesFromConfiguration("host[FOO].name"))
|
||||
assertThat(namesFromConfiguration("host[FOO].name")).toIterable()
|
||||
.containsExactly("host[FOO].name");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
* Copyright 2012-2019 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.
|
||||
|
|
@ -33,7 +33,8 @@ public class FilteredIterableConfigurationPropertiesSourceTests
|
|||
public void iteratorShouldFilterNames() {
|
||||
MockConfigurationPropertySource source = (MockConfigurationPropertySource) createTestSource();
|
||||
IterableConfigurationPropertySource filtered = source.filter(this::noBrackets);
|
||||
assertThat(filtered.iterator()).extracting(ConfigurationPropertyName::toString)
|
||||
assertThat(filtered.iterator()).toIterable()
|
||||
.extracting(ConfigurationPropertyName::toString)
|
||||
.containsExactly("a", "b", "c");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public class MapConfigurationPropertySourceTests {
|
|||
MapConfigurationPropertySource source = new MapConfigurationPropertySource();
|
||||
source.put("foo.BAR", "spring");
|
||||
source.put("foo.baz", "boot");
|
||||
assertThat(source.iterator()).containsExactly(
|
||||
assertThat(source.iterator()).toIterable().containsExactly(
|
||||
ConfigurationPropertyName.of("foo.bar"),
|
||||
ConfigurationPropertyName.of("foo.baz"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ public class SpringConfigurationPropertySourcesTests {
|
|||
new MapPropertySource("baz", Collections.singletonMap("baz", "barf")));
|
||||
SpringConfigurationPropertySources configurationSources = new SpringConfigurationPropertySources(
|
||||
sources);
|
||||
assertThat(configurationSources.iterator()).hasSize(5);
|
||||
assertThat(configurationSources.iterator()).toIterable().hasSize(5);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -163,15 +163,15 @@ public class SpringConfigurationPropertySourcesTests {
|
|||
MutablePropertySources sources = new MutablePropertySources();
|
||||
SpringConfigurationPropertySources configurationSources = new SpringConfigurationPropertySources(
|
||||
sources);
|
||||
assertThat(configurationSources.iterator()).hasSize(0);
|
||||
assertThat(configurationSources.iterator()).toIterable().hasSize(0);
|
||||
MapPropertySource source1 = new MapPropertySource("test1",
|
||||
Collections.singletonMap("a", "b"));
|
||||
sources.addLast(source1);
|
||||
assertThat(configurationSources.iterator()).hasSize(1);
|
||||
assertThat(configurationSources.iterator()).toIterable().hasSize(1);
|
||||
MapPropertySource source2 = new MapPropertySource("test2",
|
||||
Collections.singletonMap("b", "c"));
|
||||
sources.addLast(source2);
|
||||
assertThat(configurationSources.iterator()).hasSize(2);
|
||||
assertThat(configurationSources.iterator()).toIterable().hasSize(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ public class SpringIterableConfigurationPropertySourceTests {
|
|||
mapper.addFromPropertySource("key4", "my.key4");
|
||||
SpringIterableConfigurationPropertySource adapter = new SpringIterableConfigurationPropertySource(
|
||||
propertySource, mapper);
|
||||
assertThat(adapter.iterator()).extracting(Object::toString)
|
||||
assertThat(adapter.iterator()).toIterable().extracting(Object::toString)
|
||||
.containsExactly("my.key1", "my.key2a", "my.key2b", "my.key4");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2019 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.
|
||||
|
|
@ -35,26 +35,35 @@ public class SystemEnvironmentPropertyMapperTests extends AbstractPropertyMapper
|
|||
|
||||
@Test
|
||||
public void mapFromStringShouldReturnBestGuess() {
|
||||
assertThat(namesFromString("SERVER")).containsExactly("server");
|
||||
assertThat(namesFromString("SERVER_PORT")).containsExactly("server.port");
|
||||
assertThat(namesFromString("HOST_0")).containsExactly("host[0]");
|
||||
assertThat(namesFromString("HOST_0_1")).containsExactly("host[0][1]");
|
||||
assertThat(namesFromString("HOST_0_NAME")).containsExactly("host[0].name");
|
||||
assertThat(namesFromString("HOST_F00_NAME")).containsExactly("host.f00.name");
|
||||
assertThat(namesFromString("S-ERVER")).containsExactly("s-erver");
|
||||
assertThat(namesFromString("SERVER")).toIterable().containsExactly("server");
|
||||
assertThat(namesFromString("SERVER_PORT")).toIterable()
|
||||
.containsExactly("server.port");
|
||||
assertThat(namesFromString("HOST_0")).toIterable().containsExactly("host[0]");
|
||||
assertThat(namesFromString("HOST_0_1")).toIterable()
|
||||
.containsExactly("host[0][1]");
|
||||
assertThat(namesFromString("HOST_0_NAME")).toIterable()
|
||||
.containsExactly("host[0].name");
|
||||
assertThat(namesFromString("HOST_F00_NAME")).toIterable()
|
||||
.containsExactly("host.f00.name");
|
||||
assertThat(namesFromString("S-ERVER")).toIterable().containsExactly("s-erver");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mapFromConfigurationShouldReturnBestGuess() {
|
||||
assertThat(namesFromConfiguration("server")).containsExactly("SERVER");
|
||||
assertThat(namesFromConfiguration("server.port")).containsExactly("SERVER_PORT");
|
||||
assertThat(namesFromConfiguration("host[0]")).containsExactly("HOST_0");
|
||||
assertThat(namesFromConfiguration("host[0][1]")).containsExactly("HOST_0_1");
|
||||
assertThat(namesFromConfiguration("host[0].name")).containsExactly("HOST_0_NAME");
|
||||
assertThat(namesFromConfiguration("host.f00.name"))
|
||||
assertThat(namesFromConfiguration("server")).toIterable()
|
||||
.containsExactly("SERVER");
|
||||
assertThat(namesFromConfiguration("server.port")).toIterable()
|
||||
.containsExactly("SERVER_PORT");
|
||||
assertThat(namesFromConfiguration("host[0]")).toIterable()
|
||||
.containsExactly("HOST_0");
|
||||
assertThat(namesFromConfiguration("host[0][1]")).toIterable()
|
||||
.containsExactly("HOST_0_1");
|
||||
assertThat(namesFromConfiguration("host[0].name")).toIterable()
|
||||
.containsExactly("HOST_0_NAME");
|
||||
assertThat(namesFromConfiguration("host.f00.name")).toIterable()
|
||||
.containsExactly("HOST_F00_NAME");
|
||||
assertThat(namesFromConfiguration("foo.the-bar")).containsExactly("FOO_THEBAR",
|
||||
"FOO_THE_BAR");
|
||||
assertThat(namesFromConfiguration("foo.the-bar")).toIterable()
|
||||
.containsExactly("FOO_THEBAR", "FOO_THE_BAR");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
* Copyright 2012-2019 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.
|
||||
|
|
@ -48,7 +48,8 @@ public class ServletContextInitializerBeansTests {
|
|||
ServletContextInitializerBeans initializerBeans = new ServletContextInitializerBeans(
|
||||
this.context.getBeanFactory());
|
||||
assertThat(initializerBeans.size()).isEqualTo(1);
|
||||
assertThat(initializerBeans.iterator()).hasOnlyElementsOfType(TestServlet.class);
|
||||
assertThat(initializerBeans.iterator()).toIterable()
|
||||
.hasOnlyElementsOfType(TestServlet.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -57,7 +58,8 @@ public class ServletContextInitializerBeansTests {
|
|||
ServletContextInitializerBeans initializerBeans = new ServletContextInitializerBeans(
|
||||
this.context.getBeanFactory());
|
||||
assertThat(initializerBeans.size()).isEqualTo(1);
|
||||
assertThat(initializerBeans.iterator()).hasOnlyElementsOfType(TestFilter.class);
|
||||
assertThat(initializerBeans.iterator()).toIterable()
|
||||
.hasOnlyElementsOfType(TestFilter.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -66,7 +68,7 @@ public class ServletContextInitializerBeansTests {
|
|||
ServletContextInitializerBeans initializerBeans = new ServletContextInitializerBeans(
|
||||
this.context.getBeanFactory(), TestServletContextInitializer.class);
|
||||
assertThat(initializerBeans.size()).isEqualTo(1);
|
||||
assertThat(initializerBeans.iterator())
|
||||
assertThat(initializerBeans.iterator()).toIterable()
|
||||
.hasOnlyElementsOfType(TestServletContextInitializer.class);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue