Commit ecbbc7172818319f1acb2519f9ccb933c0bcc713
1 parent
2e73629c
refactor: Array-Verwaltung der Service-Tests optimiert
Showing
1 changed file
with
7 additions
and
7 deletions
src/test/java/net/ziemers/swxercise/lg/user/service/UserServiceTest.java
| 1 | package net.ziemers.swxercise.lg.user.service; | 1 | package net.ziemers.swxercise.lg.user.service; |
| 2 | 2 | ||
| 3 | -import java.util.Arrays; | 3 | +import java.util.Collections; |
| 4 | import java.util.Collection; | 4 | import java.util.Collection; |
| 5 | import java.util.HashSet; | 5 | import java.util.HashSet; |
| 6 | import java.util.Set; | 6 | import java.util.Set; |
| @@ -214,7 +214,7 @@ public class UserServiceTest extends JpaTestUtils { | @@ -214,7 +214,7 @@ public class UserServiceTest extends JpaTestUtils { | ||
| 214 | public void testIsNotLoggedInUserAllowedWithNotLoggedInRightSucceeds() { | 214 | public void testIsNotLoggedInUserAllowedWithNotLoggedInRightSucceeds() { |
| 215 | 215 | ||
| 216 | when() | 216 | when() |
| 217 | - .isUserAllowed(new HashSet<String>(Arrays.asList("NOT_LOGGED_IN"))); | 217 | + .isUserAllowed(new HashSet<>(Collections.singletonList("NOT_LOGGED_IN"))); |
| 218 | 218 | ||
| 219 | then() | 219 | then() |
| 220 | .assertIsUserAllowedSucceeded(); | 220 | .assertIsUserAllowedSucceeded(); |
| @@ -225,7 +225,7 @@ public class UserServiceTest extends JpaTestUtils { | @@ -225,7 +225,7 @@ public class UserServiceTest extends JpaTestUtils { | ||
| 225 | public void testIsNotLoggedInUserAllowedWithLoggedInRightFails() { | 225 | public void testIsNotLoggedInUserAllowedWithLoggedInRightFails() { |
| 226 | 226 | ||
| 227 | when() | 227 | when() |
| 228 | - .isUserAllowed(new HashSet<String>(Arrays.asList("LOGGED_IN"))); | 228 | + .isUserAllowed(new HashSet<>(Collections.singletonList("LOGGED_IN"))); |
| 229 | 229 | ||
| 230 | then() | 230 | then() |
| 231 | .assertIsUserAllowedFailed(); | 231 | .assertIsUserAllowedFailed(); |
| @@ -240,7 +240,7 @@ public class UserServiceTest extends JpaTestUtils { | @@ -240,7 +240,7 @@ public class UserServiceTest extends JpaTestUtils { | ||
| 240 | .loginUser(EXISTING_PASSWORD_TEST); | 240 | .loginUser(EXISTING_PASSWORD_TEST); |
| 241 | 241 | ||
| 242 | when() | 242 | when() |
| 243 | - .isUserAllowed(new HashSet<String>(Arrays.asList("LOGGED_IN"))); | 243 | + .isUserAllowed(new HashSet<>(Collections.singletonList("LOGGED_IN"))); |
| 244 | 244 | ||
| 245 | then() | 245 | then() |
| 246 | .assertIsUserAllowedSucceeded(); | 246 | .assertIsUserAllowedSucceeded(); |
| @@ -255,7 +255,7 @@ public class UserServiceTest extends JpaTestUtils { | @@ -255,7 +255,7 @@ public class UserServiceTest extends JpaTestUtils { | ||
| 255 | .loginUser(EXISTING_PASSWORD_TEST); | 255 | .loginUser(EXISTING_PASSWORD_TEST); |
| 256 | 256 | ||
| 257 | when() | 257 | when() |
| 258 | - .isUserAllowed(new HashSet<String>(Arrays.asList("NOT_LOGGED_IN"))); | 258 | + .isUserAllowed(new HashSet<>(Collections.singletonList("NOT_LOGGED_IN"))); |
| 259 | 259 | ||
| 260 | then() | 260 | then() |
| 261 | .assertIsUserAllowedFailed(); | 261 | .assertIsUserAllowedFailed(); |
| @@ -270,7 +270,7 @@ public class UserServiceTest extends JpaTestUtils { | @@ -270,7 +270,7 @@ public class UserServiceTest extends JpaTestUtils { | ||
| 270 | .loginUser(EXISTING_PASSWORD_TEST); | 270 | .loginUser(EXISTING_PASSWORD_TEST); |
| 271 | 271 | ||
| 272 | when() | 272 | when() |
| 273 | - .isUserAllowed(new HashSet<String>(Arrays.asList("ADMIN"))); | 273 | + .isUserAllowed(new HashSet<>(Collections.singletonList("ADMIN"))); |
| 274 | 274 | ||
| 275 | then() | 275 | then() |
| 276 | .assertIsUserAllowedSucceeded(); | 276 | .assertIsUserAllowedSucceeded(); |
| @@ -285,7 +285,7 @@ public class UserServiceTest extends JpaTestUtils { | @@ -285,7 +285,7 @@ public class UserServiceTest extends JpaTestUtils { | ||
| 285 | .loginUser(EXISTING_PASSWORD_TEST); | 285 | .loginUser(EXISTING_PASSWORD_TEST); |
| 286 | 286 | ||
| 287 | when() | 287 | when() |
| 288 | - .isUserAllowed(new HashSet<String>(Arrays.asList("UNKNOWN_ROLE"))); | 288 | + .isUserAllowed(new HashSet<>(Collections.singletonList("UNKNOWN_ROLE"))); |
| 289 | 289 | ||
| 290 | then() | 290 | then() |
| 291 | .assertIsUserAllowedFailed(); | 291 | .assertIsUserAllowedFailed(); |