Polish more AssertJ assertions
This commit is contained in:
@@ -30,8 +30,8 @@ public class WebXmlJ2eeDefinedRolesRetrieverTests {
|
||||
|
||||
@Test
|
||||
public void testRole1To4Roles() throws Exception {
|
||||
List<String> ROLE1TO4_EXPECTED_ROLES = Arrays.asList(new String[] { "Role1",
|
||||
"Role2", "Role3", "Role4" });
|
||||
List<String> ROLE1TO4_EXPECTED_ROLES = Arrays.asList("Role1",
|
||||
"Role2", "Role3", "Role4");
|
||||
final Resource webXml = new ClassPathResource("webxml/Role1-4.web.xml");
|
||||
WebXmlMappableAttributesRetriever rolesRetriever = new WebXmlMappableAttributesRetriever();
|
||||
|
||||
@@ -47,11 +47,9 @@ public class WebXmlJ2eeDefinedRolesRetrieverTests {
|
||||
|
||||
rolesRetriever.afterPropertiesSet();
|
||||
Set<String> j2eeRoles = rolesRetriever.getMappableAttributes();
|
||||
assertThat(j2eeRoles).isNotNull();
|
||||
assertThat(j2eeRoles.size()).withFailMessage("J2eeRoles expected size: " + ROLE1TO4_EXPECTED_ROLES.size()
|
||||
+ ", actual size: " + j2eeRoles).hasSize(ROLE1TO4_EXPECTED_ROLES.size());
|
||||
assertThat(j2eeRoles).withFailMessage("J2eeRoles expected contents (arbitrary order).isTrue(): "
|
||||
+ ROLE1TO4_EXPECTED_ROLES + ", actual content: " + j2eeRoles).containsAll(ROLE1TO4_EXPECTED_ROLES);
|
||||
assertThat(j2eeRoles).isNotNull()
|
||||
.hasSameSizeAs(ROLE1TO4_EXPECTED_ROLES)
|
||||
.containsAll(ROLE1TO4_EXPECTED_ROLES);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -69,6 +67,6 @@ public class WebXmlJ2eeDefinedRolesRetrieverTests {
|
||||
});
|
||||
rolesRetriever.afterPropertiesSet();
|
||||
Set<String> j2eeRoles = rolesRetriever.getMappableAttributes();
|
||||
assertThat(j2eeRoles).withFailMessage("actual size: " + j2eeRoles.size() + "J2eeRoles expected size: 0").isEmpty();
|
||||
assertThat(j2eeRoles).isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,7 +421,7 @@ public class AbstractRememberMeServicesTests {
|
||||
|
||||
Cookie cookie = response.getCookie(
|
||||
AbstractRememberMeServices.SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY);
|
||||
assertThat(cookie.getVersion()).isEqualTo(0);
|
||||
assertThat(cookie.getVersion()).isZero();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -453,7 +453,7 @@ public class AbstractRememberMeServicesTests {
|
||||
Cookie returnedCookie = response.getCookie(
|
||||
AbstractRememberMeServices.SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY);
|
||||
assertThat(returnedCookie).isNotNull();
|
||||
assertThat(returnedCookie.getMaxAge()).isEqualTo(0);
|
||||
assertThat(returnedCookie.getMaxAge()).isZero();
|
||||
}
|
||||
|
||||
// ~ Inner Classes
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -135,7 +135,7 @@ public class PersistentTokenBasedRememberMeServicesTests {
|
||||
"somepass", "SOME_AUTH"));
|
||||
Cookie returnedCookie = response.getCookie("mycookiename");
|
||||
assertThat(returnedCookie).isNotNull();
|
||||
assertThat(returnedCookie.getMaxAge()).isEqualTo(0);
|
||||
assertThat(returnedCookie.getMaxAge()).isZero();
|
||||
|
||||
// SEC-1280
|
||||
services.logout(request, response, null);
|
||||
|
||||
@@ -136,7 +136,7 @@ public class TokenBasedRememberMeServicesTests {
|
||||
Cookie returnedCookie = response
|
||||
.getCookie(SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY);
|
||||
assertThat(returnedCookie).isNotNull();
|
||||
assertThat(returnedCookie.getMaxAge()).isEqualTo(0);
|
||||
assertThat(returnedCookie.getMaxAge()).isZero();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -153,7 +153,7 @@ public class TokenBasedRememberMeServicesTests {
|
||||
Cookie returnedCookie = response
|
||||
.getCookie(SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY);
|
||||
assertThat(returnedCookie).isNotNull();
|
||||
assertThat(returnedCookie.getMaxAge()).isEqualTo(0);
|
||||
assertThat(returnedCookie.getMaxAge()).isZero();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -169,7 +169,7 @@ public class TokenBasedRememberMeServicesTests {
|
||||
Cookie returnedCookie = response
|
||||
.getCookie(SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY);
|
||||
assertThat(returnedCookie).isNotNull();
|
||||
assertThat(returnedCookie.getMaxAge()).isEqualTo(0);
|
||||
assertThat(returnedCookie.getMaxAge()).isZero();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -190,7 +190,7 @@ public class TokenBasedRememberMeServicesTests {
|
||||
Cookie returnedCookie = response
|
||||
.getCookie(SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY);
|
||||
assertThat(returnedCookie).isNotNull();
|
||||
assertThat(returnedCookie.getMaxAge()).isEqualTo(0);
|
||||
assertThat(returnedCookie.getMaxAge()).isZero();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -207,7 +207,7 @@ public class TokenBasedRememberMeServicesTests {
|
||||
Cookie returnedCookie = response
|
||||
.getCookie(SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY);
|
||||
assertThat(returnedCookie).isNotNull();
|
||||
assertThat(returnedCookie.getMaxAge()).isEqualTo(0);
|
||||
assertThat(returnedCookie.getMaxAge()).isZero();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -227,7 +227,7 @@ public class TokenBasedRememberMeServicesTests {
|
||||
Cookie returnedCookie = response
|
||||
.getCookie(SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY);
|
||||
assertThat(returnedCookie).isNotNull();
|
||||
assertThat(returnedCookie.getMaxAge()).isEqualTo(0);
|
||||
assertThat(returnedCookie.getMaxAge()).isZero();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -270,7 +270,7 @@ public class TokenBasedRememberMeServicesTests {
|
||||
|
||||
Cookie cookie = response.getCookie(SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY);
|
||||
assertThat(cookie).isNotNull();
|
||||
assertThat(cookie.getMaxAge()).isEqualTo(0);
|
||||
assertThat(cookie.getMaxAge()).isZero();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
@@ -106,7 +106,7 @@ public class CookieCsrfTokenRepositoryTests {
|
||||
Cookie tokenCookie = this.response
|
||||
.getCookie(CookieCsrfTokenRepository.DEFAULT_CSRF_COOKIE_NAME);
|
||||
|
||||
assertThat(tokenCookie.getMaxAge()).isEqualTo(0);
|
||||
assertThat(tokenCookie.getMaxAge()).isZero();
|
||||
assertThat(tokenCookie.getName())
|
||||
.isEqualTo(CookieCsrfTokenRepository.DEFAULT_CSRF_COOKIE_NAME);
|
||||
assertThat(tokenCookie.getPath()).isEqualTo(this.request.getContextPath());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2017 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.
|
||||
@@ -97,7 +97,7 @@ public class SavedCookieMixinTests extends AbstractMixinTests {
|
||||
assertThat(savedCookie.getName()).isEqualTo("SESSION");
|
||||
assertThat(savedCookie.getValue()).isEqualTo("123456789");
|
||||
assertThat(savedCookie.isSecure()).isEqualTo(false);
|
||||
assertThat(savedCookie.getVersion()).isEqualTo(0);
|
||||
assertThat(savedCookie.getVersion()).isZero();
|
||||
assertThat(savedCookie.getComment()).isNull();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -168,7 +168,7 @@ public class ThrowableAnalyzerTests {
|
||||
};
|
||||
|
||||
assertThat(analyzer.getRegisteredTypes().length).withFailMessage(
|
||||
"Unexpected number of registered types").isEqualTo(0);
|
||||
"Unexpected number of registered types").isZero();
|
||||
|
||||
Throwable t = this.testTrace[0];
|
||||
Throwable[] chain = analyzer.determineCauseChain(t);
|
||||
|
||||
Reference in New Issue
Block a user