Commit ecbbc7172818319f1acb2519f9ccb933c0bcc713

Authored by Thomas Ziemer
1 parent 2e73629c

refactor: Array-Verwaltung der Service-Tests optimiert

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