Use AssertJ's hasSize() for collections and maps
Achieved via a global search-and-replace.
This commit is contained in:
@@ -56,17 +56,17 @@ class ConstantsTests {
|
||||
Constants c = new Constants(A.class);
|
||||
|
||||
Set<?> names = c.getNames("");
|
||||
assertThat(names.size()).isEqualTo(c.getSize());
|
||||
assertThat(names).hasSize(c.getSize());
|
||||
assertThat(names.contains("DOG")).isTrue();
|
||||
assertThat(names.contains("CAT")).isTrue();
|
||||
assertThat(names.contains("S1")).isTrue();
|
||||
|
||||
names = c.getNames("D");
|
||||
assertThat(names.size()).isEqualTo(1);
|
||||
assertThat(names).hasSize(1);
|
||||
assertThat(names.contains("DOG")).isTrue();
|
||||
|
||||
names = c.getNames("d");
|
||||
assertThat(names.size()).isEqualTo(1);
|
||||
assertThat(names).hasSize(1);
|
||||
assertThat(names.contains("DOG")).isTrue();
|
||||
}
|
||||
|
||||
@@ -75,22 +75,22 @@ class ConstantsTests {
|
||||
Constants c = new Constants(A.class);
|
||||
|
||||
Set<?> values = c.getValues("");
|
||||
assertThat(values.size()).isEqualTo(7);
|
||||
assertThat(values).hasSize(7);
|
||||
assertThat(values.contains(0)).isTrue();
|
||||
assertThat(values.contains(66)).isTrue();
|
||||
assertThat(values.contains("")).isTrue();
|
||||
|
||||
values = c.getValues("D");
|
||||
assertThat(values.size()).isEqualTo(1);
|
||||
assertThat(values).hasSize(1);
|
||||
assertThat(values.contains(0)).isTrue();
|
||||
|
||||
values = c.getValues("prefix");
|
||||
assertThat(values.size()).isEqualTo(2);
|
||||
assertThat(values).hasSize(2);
|
||||
assertThat(values.contains(1)).isTrue();
|
||||
assertThat(values.contains(2)).isTrue();
|
||||
|
||||
values = c.getValuesForProperty("myProperty");
|
||||
assertThat(values.size()).isEqualTo(2);
|
||||
assertThat(values).hasSize(2);
|
||||
assertThat(values.contains(1)).isTrue();
|
||||
assertThat(values.contains(2)).isTrue();
|
||||
}
|
||||
@@ -103,22 +103,22 @@ class ConstantsTests {
|
||||
Constants c = new Constants(A.class);
|
||||
|
||||
Set<?> values = c.getValues("");
|
||||
assertThat(values.size()).isEqualTo(7);
|
||||
assertThat(values).hasSize(7);
|
||||
assertThat(values.contains(0)).isTrue();
|
||||
assertThat(values.contains(66)).isTrue();
|
||||
assertThat(values.contains("")).isTrue();
|
||||
|
||||
values = c.getValues("D");
|
||||
assertThat(values.size()).isEqualTo(1);
|
||||
assertThat(values).hasSize(1);
|
||||
assertThat(values.contains(0)).isTrue();
|
||||
|
||||
values = c.getValues("prefix");
|
||||
assertThat(values.size()).isEqualTo(2);
|
||||
assertThat(values).hasSize(2);
|
||||
assertThat(values.contains(1)).isTrue();
|
||||
assertThat(values.contains(2)).isTrue();
|
||||
|
||||
values = c.getValuesForProperty("myProperty");
|
||||
assertThat(values.size()).isEqualTo(2);
|
||||
assertThat(values).hasSize(2);
|
||||
assertThat(values.contains(1)).isTrue();
|
||||
assertThat(values.contains(2)).isTrue();
|
||||
}
|
||||
@@ -132,12 +132,12 @@ class ConstantsTests {
|
||||
Constants c = new Constants(A.class);
|
||||
|
||||
Set<?> names = c.getNamesForSuffix("_PROPERTY");
|
||||
assertThat(names.size()).isEqualTo(2);
|
||||
assertThat(names).hasSize(2);
|
||||
assertThat(names.contains("NO_PROPERTY")).isTrue();
|
||||
assertThat(names.contains("YES_PROPERTY")).isTrue();
|
||||
|
||||
Set<?> values = c.getValuesForSuffix("_PROPERTY");
|
||||
assertThat(values.size()).isEqualTo(2);
|
||||
assertThat(values).hasSize(2);
|
||||
assertThat(values.contains(3)).isTrue();
|
||||
assertThat(values.contains(4)).isTrue();
|
||||
}
|
||||
@@ -217,7 +217,7 @@ class ConstantsTests {
|
||||
assertThat(c.getSize()).isEqualTo(0);
|
||||
final Set<?> values = c.getValues("");
|
||||
assertThat(values).isNotNull();
|
||||
assertThat(values.size()).isEqualTo(0);
|
||||
assertThat(values).hasSize(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -121,7 +121,7 @@ class GenericTypeResolverTests {
|
||||
assertThat(map.toString()).isEqualTo("{T=class java.lang.Integer}");
|
||||
|
||||
map = GenericTypeResolver.getTypeVariableMap(TypedTopLevelClass.TypedNested.class);
|
||||
assertThat(map.size()).isEqualTo(2);
|
||||
assertThat(map).hasSize(2);
|
||||
Type t = null;
|
||||
Type x = null;
|
||||
for (Map.Entry<TypeVariable, Type> entry : map.entrySet()) {
|
||||
|
||||
@@ -874,7 +874,7 @@ class AnnotatedElementUtilsTests {
|
||||
void findAllMergedAnnotationsOnClassWithInterface() throws Exception {
|
||||
Method method = TransactionalServiceImpl.class.getMethod("doIt");
|
||||
Set<Transactional> allMergedAnnotations = findAllMergedAnnotations(method, Transactional.class);
|
||||
assertThat(allMergedAnnotations.size()).isEqualTo(1);
|
||||
assertThat(allMergedAnnotations).hasSize(1);
|
||||
}
|
||||
|
||||
@Test // SPR-16060
|
||||
|
||||
@@ -112,7 +112,7 @@ class ComposedRepeatableAnnotationsTests {
|
||||
Class<?> element = SubNoninheritedRepeatableClass.class;
|
||||
Set<Noninherited> annotations = getMergedRepeatableAnnotations(element, Noninherited.class);
|
||||
assertThat(annotations).isNotNull();
|
||||
assertThat(annotations.size()).isEqualTo(0);
|
||||
assertThat(annotations).hasSize(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -216,7 +216,7 @@ class ComposedRepeatableAnnotationsTests {
|
||||
|
||||
Set<PeteRepeat> peteRepeats = getMergedRepeatableAnnotations(element, PeteRepeat.class);
|
||||
assertThat(peteRepeats).isNotNull();
|
||||
assertThat(peteRepeats.size()).isEqualTo(3);
|
||||
assertThat(peteRepeats).hasSize(3);
|
||||
|
||||
Iterator<PeteRepeat> iterator = peteRepeats.iterator();
|
||||
assertThat(iterator.next().value()).isEqualTo("A");
|
||||
@@ -229,7 +229,7 @@ class ComposedRepeatableAnnotationsTests {
|
||||
|
||||
Set<PeteRepeat> peteRepeats = findMergedRepeatableAnnotations(element, PeteRepeat.class);
|
||||
assertThat(peteRepeats).isNotNull();
|
||||
assertThat(peteRepeats.size()).isEqualTo(3);
|
||||
assertThat(peteRepeats).hasSize(3);
|
||||
|
||||
Iterator<PeteRepeat> iterator = peteRepeats.iterator();
|
||||
assertThat(iterator.next().value()).isEqualTo("A");
|
||||
@@ -239,7 +239,7 @@ class ComposedRepeatableAnnotationsTests {
|
||||
|
||||
private void assertNoninheritedRepeatableAnnotations(Set<Noninherited> annotations) {
|
||||
assertThat(annotations).isNotNull();
|
||||
assertThat(annotations.size()).isEqualTo(3);
|
||||
assertThat(annotations).hasSize(3);
|
||||
|
||||
Iterator<Noninherited> iterator = annotations.iterator();
|
||||
assertThat(iterator.next().value()).isEqualTo("A");
|
||||
|
||||
@@ -62,7 +62,7 @@ class MultipleComposedAnnotationsOnSingleAnnotatedElementTests {
|
||||
Class<?> element = MultipleNoninheritedComposedCachesClass.class;
|
||||
Set<Cacheable> cacheables = getAllMergedAnnotations(element, Cacheable.class);
|
||||
assertThat(cacheables).isNotNull();
|
||||
assertThat(cacheables.size()).isEqualTo(2);
|
||||
assertThat(cacheables).hasSize(2);
|
||||
|
||||
Iterator<Cacheable> iterator = cacheables.iterator();
|
||||
Cacheable cacheable1 = iterator.next();
|
||||
@@ -76,7 +76,7 @@ class MultipleComposedAnnotationsOnSingleAnnotatedElementTests {
|
||||
Class<?> element = SubMultipleNoninheritedComposedCachesClass.class;
|
||||
Set<Cacheable> cacheables = getAllMergedAnnotations(element, Cacheable.class);
|
||||
assertThat(cacheables).isNotNull();
|
||||
assertThat(cacheables.size()).isEqualTo(0);
|
||||
assertThat(cacheables).hasSize(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -89,7 +89,7 @@ class MultipleComposedAnnotationsOnSingleAnnotatedElementTests {
|
||||
Class<MultipleComposedCachesOnInterfaceClass> element = MultipleComposedCachesOnInterfaceClass.class;
|
||||
Set<Cacheable> cacheables = getAllMergedAnnotations(element, Cacheable.class);
|
||||
assertThat(cacheables).isNotNull();
|
||||
assertThat(cacheables.size()).isEqualTo(0);
|
||||
assertThat(cacheables).hasSize(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -109,7 +109,7 @@ class MultipleComposedAnnotationsOnSingleAnnotatedElementTests {
|
||||
void getMultipleComposedAnnotationsOnBridgeMethod() throws Exception {
|
||||
Set<Cacheable> cacheables = getAllMergedAnnotations(getBridgeMethod(), Cacheable.class);
|
||||
assertThat(cacheables).isNotNull();
|
||||
assertThat(cacheables.size()).isEqualTo(0);
|
||||
assertThat(cacheables).hasSize(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -127,7 +127,7 @@ class MultipleComposedAnnotationsOnSingleAnnotatedElementTests {
|
||||
Class<?> element = MultipleNoninheritedComposedCachesClass.class;
|
||||
Set<Cacheable> cacheables = findAllMergedAnnotations(element, Cacheable.class);
|
||||
assertThat(cacheables).isNotNull();
|
||||
assertThat(cacheables.size()).isEqualTo(2);
|
||||
assertThat(cacheables).hasSize(2);
|
||||
|
||||
Iterator<Cacheable> iterator = cacheables.iterator();
|
||||
Cacheable cacheable1 = iterator.next();
|
||||
@@ -141,7 +141,7 @@ class MultipleComposedAnnotationsOnSingleAnnotatedElementTests {
|
||||
Class<?> element = SubMultipleNoninheritedComposedCachesClass.class;
|
||||
Set<Cacheable> cacheables = findAllMergedAnnotations(element, Cacheable.class);
|
||||
assertThat(cacheables).isNotNull();
|
||||
assertThat(cacheables.size()).isEqualTo(2);
|
||||
assertThat(cacheables).hasSize(2);
|
||||
|
||||
Iterator<Cacheable> iterator = cacheables.iterator();
|
||||
Cacheable cacheable1 = iterator.next();
|
||||
@@ -213,7 +213,7 @@ class MultipleComposedAnnotationsOnSingleAnnotatedElementTests {
|
||||
|
||||
Set<Cacheable> cacheables = getAllMergedAnnotations(element, Cacheable.class);
|
||||
assertThat(cacheables).isNotNull();
|
||||
assertThat(cacheables.size()).isEqualTo(2);
|
||||
assertThat(cacheables).hasSize(2);
|
||||
|
||||
Iterator<Cacheable> iterator = cacheables.iterator();
|
||||
Cacheable fooCacheable = iterator.next();
|
||||
@@ -229,7 +229,7 @@ class MultipleComposedAnnotationsOnSingleAnnotatedElementTests {
|
||||
|
||||
Set<Cacheable> cacheables = findAllMergedAnnotations(element, Cacheable.class);
|
||||
assertThat(cacheables).isNotNull();
|
||||
assertThat(cacheables.size()).isEqualTo(2);
|
||||
assertThat(cacheables).hasSize(2);
|
||||
|
||||
Iterator<Cacheable> iterator = cacheables.iterator();
|
||||
Cacheable fooCacheable = iterator.next();
|
||||
|
||||
@@ -681,7 +681,7 @@ class DefaultConversionServiceTests {
|
||||
Collection values = map.values();
|
||||
List<Integer> bar = (List<Integer>) conversionService.convert(values,
|
||||
TypeDescriptor.forObject(values), new TypeDescriptor(getClass().getField("genericList")));
|
||||
assertThat(bar.size()).isEqualTo(3);
|
||||
assertThat(bar).hasSize(3);
|
||||
assertThat(bar.get(0)).isEqualTo(1);
|
||||
assertThat(bar.get(1)).isEqualTo(2);
|
||||
assertThat(bar.get(2)).isEqualTo(3);
|
||||
@@ -745,7 +745,7 @@ class DefaultConversionServiceTests {
|
||||
@Test
|
||||
void convertStringToProperties() {
|
||||
Properties result = conversionService.convert("a=b\nc=2\nd=", Properties.class);
|
||||
assertThat(result.size()).isEqualTo(3);
|
||||
assertThat(result).hasSize(3);
|
||||
assertThat(result.getProperty("a")).isEqualTo("b");
|
||||
assertThat(result.getProperty("c")).isEqualTo("2");
|
||||
assertThat(result.getProperty("d")).isEqualTo("");
|
||||
|
||||
@@ -195,7 +195,7 @@ class CollectionToCollectionConverterTests {
|
||||
aSource, TypeDescriptor.forObject(aSource), TypeDescriptor.forObject(new ArrayList()));
|
||||
boolean condition = myConverted instanceof ArrayList<?>;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(((ArrayList<?>) myConverted).size()).isEqualTo(aSource.size());
|
||||
assertThat(((ArrayList<?>) myConverted)).hasSize(aSource.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -240,7 +240,7 @@ class MapToMapConverterTests {
|
||||
TypeDescriptor targetType = new TypeDescriptor(getClass().getField("multiValueMapTarget"));
|
||||
|
||||
MultiValueMap<String, String> converted = (MultiValueMap<String, String>) conversionService.convert(source, targetType);
|
||||
assertThat(converted.size()).isEqualTo(2);
|
||||
assertThat(converted).hasSize(2);
|
||||
assertThat(converted.get("a")).isEqualTo(Arrays.asList("1", "2", "3"));
|
||||
assertThat(converted.get("b")).isEqualTo(Arrays.asList("4", "5", "6"));
|
||||
}
|
||||
@@ -255,7 +255,7 @@ class MapToMapConverterTests {
|
||||
TypeDescriptor targetType = new TypeDescriptor(getClass().getField("multiValueMapTarget"));
|
||||
|
||||
MultiValueMap<String, String> converted = (MultiValueMap<String, String>) conversionService.convert(source, targetType);
|
||||
assertThat(converted.size()).isEqualTo(2);
|
||||
assertThat(converted).hasSize(2);
|
||||
assertThat(converted.get("a")).isEqualTo(Arrays.asList("1"));
|
||||
assertThat(converted.get("b")).isEqualTo(Arrays.asList("2"));
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class MutablePropertySourcesTests {
|
||||
sources.addLast(new MockPropertySource("d").withProperty("p1", "dValue"));
|
||||
sources.addLast(new MockPropertySource("f").withProperty("p1", "fValue"));
|
||||
|
||||
assertThat(sources.size()).isEqualTo(3);
|
||||
assertThat(sources).hasSize(3);
|
||||
assertThat(sources.contains("a")).isFalse();
|
||||
assertThat(sources.contains("b")).isTrue();
|
||||
assertThat(sources.contains("c")).isFalse();
|
||||
@@ -56,7 +56,7 @@ class MutablePropertySourcesTests {
|
||||
sources.addBefore("b", new MockPropertySource("a"));
|
||||
sources.addAfter("b", new MockPropertySource("c"));
|
||||
|
||||
assertThat(sources.size()).isEqualTo(5);
|
||||
assertThat(sources).hasSize(5);
|
||||
assertThat(sources.precedenceOf(PropertySource.named("a"))).isEqualTo(0);
|
||||
assertThat(sources.precedenceOf(PropertySource.named("b"))).isEqualTo(1);
|
||||
assertThat(sources.precedenceOf(PropertySource.named("c"))).isEqualTo(2);
|
||||
@@ -66,7 +66,7 @@ class MutablePropertySourcesTests {
|
||||
sources.addBefore("f", new MockPropertySource("e"));
|
||||
sources.addAfter("f", new MockPropertySource("g"));
|
||||
|
||||
assertThat(sources.size()).isEqualTo(7);
|
||||
assertThat(sources).hasSize(7);
|
||||
assertThat(sources.precedenceOf(PropertySource.named("a"))).isEqualTo(0);
|
||||
assertThat(sources.precedenceOf(PropertySource.named("b"))).isEqualTo(1);
|
||||
assertThat(sources.precedenceOf(PropertySource.named("c"))).isEqualTo(2);
|
||||
@@ -76,7 +76,7 @@ class MutablePropertySourcesTests {
|
||||
assertThat(sources.precedenceOf(PropertySource.named("g"))).isEqualTo(6);
|
||||
|
||||
sources.addLast(new MockPropertySource("a"));
|
||||
assertThat(sources.size()).isEqualTo(7);
|
||||
assertThat(sources).hasSize(7);
|
||||
assertThat(sources.precedenceOf(PropertySource.named("b"))).isEqualTo(0);
|
||||
assertThat(sources.precedenceOf(PropertySource.named("c"))).isEqualTo(1);
|
||||
assertThat(sources.precedenceOf(PropertySource.named("d"))).isEqualTo(2);
|
||||
@@ -86,7 +86,7 @@ class MutablePropertySourcesTests {
|
||||
assertThat(sources.precedenceOf(PropertySource.named("a"))).isEqualTo(6);
|
||||
|
||||
sources.addFirst(new MockPropertySource("a"));
|
||||
assertThat(sources.size()).isEqualTo(7);
|
||||
assertThat(sources).hasSize(7);
|
||||
assertThat(sources.precedenceOf(PropertySource.named("a"))).isEqualTo(0);
|
||||
assertThat(sources.precedenceOf(PropertySource.named("b"))).isEqualTo(1);
|
||||
assertThat(sources.precedenceOf(PropertySource.named("c"))).isEqualTo(2);
|
||||
@@ -96,11 +96,11 @@ class MutablePropertySourcesTests {
|
||||
assertThat(sources.precedenceOf(PropertySource.named("g"))).isEqualTo(6);
|
||||
|
||||
assertThat(PropertySource.named("a")).isEqualTo(sources.remove("a"));
|
||||
assertThat(sources.size()).isEqualTo(6);
|
||||
assertThat(sources).hasSize(6);
|
||||
assertThat(sources.contains("a")).isFalse();
|
||||
|
||||
assertThat((Object) sources.remove("a")).isNull();
|
||||
assertThat(sources.size()).isEqualTo(6);
|
||||
assertThat(sources).hasSize(6);
|
||||
|
||||
String bogusPS = "bogus";
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
@@ -108,13 +108,13 @@ class MutablePropertySourcesTests {
|
||||
.withMessageContaining("does not exist");
|
||||
|
||||
sources.addFirst(new MockPropertySource("a"));
|
||||
assertThat(sources.size()).isEqualTo(7);
|
||||
assertThat(sources).hasSize(7);
|
||||
assertThat(sources.precedenceOf(PropertySource.named("a"))).isEqualTo(0);
|
||||
assertThat(sources.precedenceOf(PropertySource.named("b"))).isEqualTo(1);
|
||||
assertThat(sources.precedenceOf(PropertySource.named("c"))).isEqualTo(2);
|
||||
|
||||
sources.replace("a", new MockPropertySource("a-replaced"));
|
||||
assertThat(sources.size()).isEqualTo(7);
|
||||
assertThat(sources).hasSize(7);
|
||||
assertThat(sources.precedenceOf(PropertySource.named("a-replaced"))).isEqualTo(0);
|
||||
assertThat(sources.precedenceOf(PropertySource.named("b"))).isEqualTo(1);
|
||||
assertThat(sources.precedenceOf(PropertySource.named("c"))).isEqualTo(2);
|
||||
|
||||
@@ -114,7 +114,7 @@ class AnnotationMetadataTests {
|
||||
assertThat(metadata.getAnnotationAttributes(Component.class.getName())).isNull();
|
||||
assertThat(metadata.getAnnotationAttributes(MetaAnnotation.class.getName(), false)).isNull();
|
||||
assertThat(metadata.getAnnotationAttributes(MetaAnnotation.class.getName(), true)).isNull();
|
||||
assertThat(metadata.getAnnotatedMethods(DirectAnnotation.class.getName()).size()).isEqualTo(0);
|
||||
assertThat(metadata.getAnnotatedMethods(DirectAnnotation.class.getName())).hasSize(0);
|
||||
assertThat(metadata.isAnnotated(IsAnnotatedAnnotation.class.getName())).isFalse();
|
||||
assertThat(metadata.getAllAnnotationAttributes(DirectAnnotation.class.getName())).isNull();
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public abstract class MockitoUtils {
|
||||
private static void verifySameInvocations(List<Invocation> expectedInvocations, List<Invocation> actualInvocations,
|
||||
InvocationArgumentsAdapter... argumentAdapters) {
|
||||
|
||||
assertThat(expectedInvocations.size()).isEqualTo(actualInvocations.size());
|
||||
assertThat(expectedInvocations).hasSize(actualInvocations.size());
|
||||
for (int i = 0; i < expectedInvocations.size(); i++) {
|
||||
verifySameInvocation(expectedInvocations.get(i), actualInvocations.get(i), argumentAdapters);
|
||||
}
|
||||
|
||||
@@ -647,22 +647,22 @@ class AntPathMatcherTests {
|
||||
@Test
|
||||
void preventCreatingStringMatchersIfPathDoesNotStartsWithPatternPrefix() {
|
||||
pathMatcher.setCachePatterns(true);
|
||||
assertThat(pathMatcher.stringMatcherCache.size()).isEqualTo(0);
|
||||
assertThat(pathMatcher.stringMatcherCache).hasSize(0);
|
||||
|
||||
pathMatcher.match("test?", "test");
|
||||
assertThat(pathMatcher.stringMatcherCache.size()).isEqualTo(1);
|
||||
assertThat(pathMatcher.stringMatcherCache).hasSize(1);
|
||||
|
||||
pathMatcher.match("test?", "best");
|
||||
pathMatcher.match("test/*", "view/test.jpg");
|
||||
pathMatcher.match("test/**/test.jpg", "view/test.jpg");
|
||||
pathMatcher.match("test/{name}.jpg", "view/test.jpg");
|
||||
assertThat(pathMatcher.stringMatcherCache.size()).isEqualTo(1);
|
||||
assertThat(pathMatcher.stringMatcherCache).hasSize(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
void creatingStringMatchersIfPatternPrefixCannotDetermineIfPathMatch() {
|
||||
pathMatcher.setCachePatterns(true);
|
||||
assertThat(pathMatcher.stringMatcherCache.size()).isEqualTo(0);
|
||||
assertThat(pathMatcher.stringMatcherCache).hasSize(0);
|
||||
|
||||
pathMatcher.match("test", "testian");
|
||||
pathMatcher.match("test?", "testFf");
|
||||
@@ -673,7 +673,7 @@ class AntPathMatcherTests {
|
||||
pathMatcher.match("/**/{name}.jpg", "/test/lorem.jpg");
|
||||
pathMatcher.match("/*/dir/{name}.jpg", "/*/dir/lorem.jpg");
|
||||
|
||||
assertThat(pathMatcher.stringMatcherCache.size()).isEqualTo(7);
|
||||
assertThat(pathMatcher.stringMatcherCache).hasSize(7);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -38,7 +38,7 @@ class LinkedCaseInsensitiveMapTests {
|
||||
assertThat(map.put("key", "value1")).isNull();
|
||||
assertThat(map.put("key", "value2")).isEqualTo("value1");
|
||||
assertThat(map.put("key", "value3")).isEqualTo("value2");
|
||||
assertThat(map.size()).isEqualTo(1);
|
||||
assertThat(map).hasSize(1);
|
||||
assertThat(map.get("key")).isEqualTo("value3");
|
||||
assertThat(map.get("KEY")).isEqualTo("value3");
|
||||
assertThat(map.get("Key")).isEqualTo("value3");
|
||||
@@ -55,7 +55,7 @@ class LinkedCaseInsensitiveMapTests {
|
||||
assertThat(map.put("key", "value1")).isNull();
|
||||
assertThat(map.put("KEY", "value2")).isEqualTo("value1");
|
||||
assertThat(map.put("Key", "value3")).isEqualTo("value2");
|
||||
assertThat(map.size()).isEqualTo(1);
|
||||
assertThat(map).hasSize(1);
|
||||
assertThat(map.get("key")).isEqualTo("value3");
|
||||
assertThat(map.get("KEY")).isEqualTo("value3");
|
||||
assertThat(map.get("Key")).isEqualTo("value3");
|
||||
@@ -128,8 +128,8 @@ class LinkedCaseInsensitiveMapTests {
|
||||
assertThat(copy.get("Key")).isEqualTo("value1");
|
||||
|
||||
copy.put("Key", "value2");
|
||||
assertThat(map.size()).isEqualTo(1);
|
||||
assertThat(copy.size()).isEqualTo(1);
|
||||
assertThat(map).hasSize(1);
|
||||
assertThat(copy).hasSize(1);
|
||||
assertThat(map.get("key")).isEqualTo("value1");
|
||||
assertThat(map.get("KEY")).isEqualTo("value1");
|
||||
assertThat(map.get("Key")).isEqualTo("value1");
|
||||
@@ -159,7 +159,7 @@ class LinkedCaseInsensitiveMapTests {
|
||||
void removeFromKeySetViaIterator() {
|
||||
map.put("key", "value");
|
||||
nextAndRemove(map.keySet().iterator());
|
||||
assertThat(map.size()).isEqualTo(0);
|
||||
assertThat(map).hasSize(0);
|
||||
map.computeIfAbsent("key", k -> "newvalue");
|
||||
assertThat(map.get("key")).isEqualTo("newvalue");
|
||||
}
|
||||
@@ -168,7 +168,7 @@ class LinkedCaseInsensitiveMapTests {
|
||||
void clearFromValues() {
|
||||
map.put("key", "value");
|
||||
map.values().clear();
|
||||
assertThat(map.size()).isEqualTo(0);
|
||||
assertThat(map).hasSize(0);
|
||||
map.computeIfAbsent("key", k -> "newvalue");
|
||||
assertThat(map.get("key")).isEqualTo("newvalue");
|
||||
}
|
||||
@@ -177,7 +177,7 @@ class LinkedCaseInsensitiveMapTests {
|
||||
void removeFromValues() {
|
||||
map.put("key", "value");
|
||||
map.values().remove("value");
|
||||
assertThat(map.size()).isEqualTo(0);
|
||||
assertThat(map).hasSize(0);
|
||||
map.computeIfAbsent("key", k -> "newvalue");
|
||||
assertThat(map.get("key")).isEqualTo("newvalue");
|
||||
}
|
||||
@@ -186,7 +186,7 @@ class LinkedCaseInsensitiveMapTests {
|
||||
void removeFromValuesViaIterator() {
|
||||
map.put("key", "value");
|
||||
nextAndRemove(map.values().iterator());
|
||||
assertThat(map.size()).isEqualTo(0);
|
||||
assertThat(map).hasSize(0);
|
||||
map.computeIfAbsent("key", k -> "newvalue");
|
||||
assertThat(map.get("key")).isEqualTo("newvalue");
|
||||
}
|
||||
@@ -195,7 +195,7 @@ class LinkedCaseInsensitiveMapTests {
|
||||
void clearFromEntrySet() {
|
||||
map.put("key", "value");
|
||||
map.entrySet().clear();
|
||||
assertThat(map.size()).isEqualTo(0);
|
||||
assertThat(map).hasSize(0);
|
||||
map.computeIfAbsent("key", k -> "newvalue");
|
||||
assertThat(map.get("key")).isEqualTo("newvalue");
|
||||
}
|
||||
@@ -204,7 +204,7 @@ class LinkedCaseInsensitiveMapTests {
|
||||
void removeFromEntrySet() {
|
||||
map.put("key", "value");
|
||||
map.entrySet().remove(map.entrySet().iterator().next());
|
||||
assertThat(map.size()).isEqualTo(0);
|
||||
assertThat(map).hasSize(0);
|
||||
map.computeIfAbsent("key", k -> "newvalue");
|
||||
assertThat(map.get("key")).isEqualTo("newvalue");
|
||||
}
|
||||
@@ -213,7 +213,7 @@ class LinkedCaseInsensitiveMapTests {
|
||||
void removeFromEntrySetViaIterator() {
|
||||
map.put("key", "value");
|
||||
nextAndRemove(map.entrySet().iterator());
|
||||
assertThat(map.size()).isEqualTo(0);
|
||||
assertThat(map).hasSize(0);
|
||||
map.computeIfAbsent("key", k -> "newvalue");
|
||||
assertThat(map.get("key")).isEqualTo("newvalue");
|
||||
}
|
||||
|
||||
@@ -344,7 +344,7 @@ class MimeTypeTests {
|
||||
String s = String.join(",", mimeTypes);
|
||||
List<MimeType> actual = MimeTypeUtils.parseMimeTypes(s);
|
||||
|
||||
assertThat(actual.size()).isEqualTo(mimeTypes.length);
|
||||
assertThat(actual).hasSize(mimeTypes.length);
|
||||
for (int i = 0; i < mimeTypes.length; i++) {
|
||||
assertThat(actual.get(i).toString()).isEqualTo(mimeTypes[i]);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class UnmodifiableMultiValueMapTests {
|
||||
UnmodifiableMultiValueMap<String, String> map = new UnmodifiableMultiValueMap<>(mock);
|
||||
|
||||
given(mock.size()).willReturn(1);
|
||||
assertThat(map.size()).isEqualTo(1);
|
||||
assertThat(map).hasSize(1);
|
||||
|
||||
given(mock.isEmpty()).willReturn(false);
|
||||
assertThat(map.isEmpty()).isFalse();
|
||||
@@ -107,7 +107,7 @@ class UnmodifiableMultiValueMapTests {
|
||||
Set<Map.Entry<String, List<String>>> set = new UnmodifiableMultiValueMap<>(mockMap).entrySet();
|
||||
|
||||
given(mockSet.size()).willReturn(1);
|
||||
assertThat(set.size()).isEqualTo(1);
|
||||
assertThat(set).hasSize(1);
|
||||
|
||||
given(mockSet.isEmpty()).willReturn(false);
|
||||
assertThat(set.isEmpty()).isFalse();
|
||||
@@ -149,7 +149,7 @@ class UnmodifiableMultiValueMapTests {
|
||||
Collection<List<String>> values = new UnmodifiableMultiValueMap<>(mockMap).values();
|
||||
|
||||
given(mockValues.size()).willReturn(1);
|
||||
assertThat(values.size()).isEqualTo(1);
|
||||
assertThat(values).hasSize(1);
|
||||
|
||||
given(mockValues.isEmpty()).willReturn(false);
|
||||
assertThat(values.isEmpty()).isFalse();
|
||||
|
||||
Reference in New Issue
Block a user