Commit e0c18023 authored by Guillaume Lépine's avatar Guillaume Lépine
Browse files

FORMS-711: Fix request

parent f7ec4b27
......@@ -42,6 +42,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.collections4.CollectionUtils;
/**
* This class provides Data Access methods for Group objects
*/
......@@ -211,6 +213,10 @@ public final class GroupDAO implements IGroupDAO
public List<Group> selectGroupsListByListIdStep( List<Integer> idSteplist, Plugin plugin )
{
List<Group> groupList = new ArrayList<>( );
if ( CollectionUtils.isEmpty( idSteplist ) )
{
return groupList;
}
String query = SQL_QUERY_SELECTALL + " WHERE id_step IN ( ";
query += idSteplist.stream( ).map( i -> "?" ).collect( Collectors.joining( "," ) );
......
......@@ -33,6 +33,11 @@
*/
package fr.paris.lutece.plugins.forms.business;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.collections4.CollectionUtils;
import fr.paris.lutece.test.LuteceTestCase;
/**
......@@ -82,8 +87,17 @@ public class GroupBusinessTest extends LuteceTestCase
assertEquals( groupStored.getIterationMin( ), group.getIterationMin( ) );
// List test
GroupHome.getGroupsList( );
List<Group> list = GroupHome.getGroupsList( );
assertEquals( 1, list.size( ) );
List<Integer> idStepList = new ArrayList<>( );
list = GroupHome.getGroupsListByIdStepList( idStepList );
assertEquals( 0, list.size( ) );
idStepList.add( IDSTEP2 );
list = GroupHome.getGroupsListByIdStepList( idStepList );
assertEquals( 1, list.size( ) );
// Delete test
GroupHome.remove( group.getId( ) );
groupStored = GroupHome.findByPrimaryKey( group.getId( ) );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment