Source:
public void testOnlyVisibleGroupsReturned ( ) throws com.google.gwtorm.server.OrmException , com.jcraft.jsch.JSchException , java.io.IOException { com.google.gerrit.acceptance.TestAccount user = accounts.create ( "user" , "user@example.com" , "User" ) ; com.google.gerrit.acceptance.RestSession userSession = new com.google.gerrit.acceptance.RestSession ( server , user ) ; java.lang.String newGroupName = "newGroup" ; com.google.gerrit.acceptance.rest.group.GroupInput in = new com.google.gerrit.acceptance.rest.group.GroupInput ( ) ; in.description = "a hidden group" ; in.visible_to_all = false ; in.owner_id = groupCache.get ( new com.google.gerrit.reviewdb.client.AccountGroup.NameKey ( "Administrators" ) ) . getGroupUUID ( ) . get ( ) ; session.put ( ( "/groups/" + newGroupName ) , in ) . consume ( ) ; java.util.Set < java.lang.String > expectedGroups = com.google.common.collect.Sets.newHashSet ( newGroupName ) ; com.google.gerrit.acceptance.RestResponse r = userSession.get ( "/groups/" ) ; java.util.Map < java.lang.String , com.google.gerrit.acceptance.rest.group.GroupInfo > result = new com.google.gson.Gson ( ) . fromJson ( r.getReader ( ) , new com.google.gson.reflect.TypeToken < java.util.Map < java.lang.String , com.google.gerrit.acceptance.rest.group.GroupInfo > > ( ) { } . getType ( ) ) ; org.junit.Assert.assertTrue ( "no groups visible" , result.isEmpty ( ) ) ; org.junit.Assert.assertEquals ( HttpStatus.SC_CREATED , session.put ( java.lang.String.format ( "/groups/%s/members/%s" , newGroupName , user.username ) ) . getStatusCode ( ) ) ; r = userSession.get ( "/groups/" ) ; result = new com.google.gson.Gson ( ) . fromJson ( r.getReader ( ) , new com.google.gson.reflect.TypeToken < java.util.Map < java.lang.String , com.google.gerrit.acceptance.rest.group.GroupInfo > > ( ) { } . getType ( ) ) ; com.google.gerrit.acceptance.rest.group.GroupAssert.assertGroups ( expectedGroups , result.keySet ( ) ) ; }

Target:
public void testOnlyVisibleGroupsReturned ( ) throws com.google.gwtorm.server.OrmException , com.jcraft.jsch.JSchException , java.io.IOException { com.google.gerrit.acceptance.TestAccount user = accounts.create ( "user" , "user@example.com" , "User" ) ; com.google.gerrit.acceptance.RestSession userSession = new com.google.gerrit.acceptance.RestSession ( server , user ) ; java.lang.String newGroupName = "newGroup" ; com.google.gerrit.server.group.CreateGroup.Input in = new com.google.gerrit.server.group.CreateGroup.Input ( ) ; in.description = "a hidden group" ; in.visibleToAll = false ; in.ownerId = groupCache.get ( new com.google.gerrit.reviewdb.client.AccountGroup.NameKey ( "Administrators" ) ) . getGroupUUID ( ) . get ( ) ; session.put ( ( "/groups/" + newGroupName ) , in ) . consume ( ) ; java.util.Set < java.lang.String > expectedGroups = com.google.common.collect.Sets.newHashSet ( newGroupName ) ; com.google.gerrit.acceptance.RestResponse r = userSession.get ( "/groups/" ) ; java.util.Map < java.lang.String , com.google.gerrit.server.group.GroupJson.GroupInfo > result = newGson ( ) . fromJson ( r.getReader ( ) , new com.google.gson.reflect.TypeToken < java.util.Map < java.lang.String , com.google.gerrit.server.group.GroupJson.GroupInfo > > ( ) { } . getType ( ) ) ; org.junit.Assert.assertTrue ( "no groups visible" , result.isEmpty ( ) ) ; org.junit.Assert.assertEquals ( HttpStatus.SC_CREATED , session.put ( java.lang.String.format ( "/groups/%s/members/%s" , newGroupName , user.username ) ) . getStatusCode ( ) ) ; r = userSession.get ( "/groups/" ) ; result = newGson ( ) . fromJson ( r.getReader ( ) , new com.google.gson.reflect.TypeToken < java.util.Map < java.lang.String , com.google.gerrit.server.group.GroupJson.GroupInfo > > ( ) { } . getType ( ) ) ; com.google.gerrit.acceptance.rest.group.GroupAssert.assertGroups ( expectedGroups , result.keySet ( ) ) ; }