@@ -151,7 +151,8 @@ public void testDeleteSubAccount() throws Exception {
151151 @ Test
152152 public void testGetUser () throws Exception {
153153 ApiResponse user = createUser ();
154- ApiResponse result = account .user (user .get ("id" ).toString (), null );
154+ String id = user .get ("id" ).toString ();
155+ ApiResponse result = account .user (id , null );
155156 assertNotNull (result );
156157 }
157158
@@ -183,9 +184,9 @@ public void testCreateUser() throws Exception {
183184 @ Test
184185 public void testUpdateUser () throws Exception {
185186 ApiResponse user = createUser (Account .Role .ADMIN );
186-
187+ String id = user . get ( "id" ). toString ();
187188 String newName = randomLetters ();
188- ApiResponse result = account .updateUser (user . get ( "id" ). toString () , newName , null , null , null , null );
189+ ApiResponse result = account .updateUser (id , newName , null , null , null , null );
189190 assertNotNull (result );
190191 assertEquals (result .get ("name" ), newName );
191192 }
@@ -228,7 +229,8 @@ public void testDeleteUserGroup() throws Exception {
228229 public void testAddUserToUserGroup () throws Exception {
229230 ApiResponse user = createUser ();
230231 ApiResponse group = createGroup ();
231- ApiResponse result = account .addUserToGroup (group .get ("id" ).toString (), user .get ("id" ).toString (), null );
232+ String userId = user .get ("id" ).toString ();
233+ ApiResponse result = account .addUserToGroup (group .get ("id" ).toString (), userId , null );
232234 assertNotNull (result );
233235 }
234236
@@ -280,7 +282,6 @@ private ApiResponse createGroup() throws Exception {
280282 ApiResponse userGroup = account .createUserGroup (name );
281283 createdGroupIds .add (userGroup .get ("id" ).toString ());
282284 return userGroup ;
283-
284285 }
285286
286287 private ApiResponse createUser (Account .Role role ) throws Exception {
@@ -313,7 +314,6 @@ private static String randomLetters() {
313314 for (int i = 0 ; i < 10 ; i ++) {
314315 sb .append ((char ) ('a' + rand .nextInt ('z' - 'a' + 1 )));
315316 }
316-
317317 return sb .toString ();
318318 }
319319}
0 commit comments