Skip to content

LUT-29928 : update unit tests #425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import fr.paris.lutece.plugins.genericattributes.business.Entry;
import fr.paris.lutece.plugins.genericattributes.business.EntryHome;
import fr.paris.lutece.plugins.genericattributes.business.EntryType;
import fr.paris.lutece.plugins.genericattributes.business.EntryTypeHome;
import fr.paris.lutece.plugins.genericattributes.business.Response;
import fr.paris.lutece.plugins.genericattributes.business.ResponseHome;
import fr.paris.lutece.portal.business.file.File;
Expand All @@ -85,10 +86,6 @@ public class FormServiceTest extends LuteceTestCase {
private static final String DEFAULT_QUESTION_CODE = "default_question_code";
private static final String DEFAULT_QUESTION_COLUMN_TITLE = "default_question_column_title";

// Entry
private static final int ENTRY_TYPE_FILE_ID = 108;
private static final String ENTRY_TYPE_TITLE = "default_entry_type_title";

// Entry type
private static final String BEAN_NAME_ENTRY_TYPE_FILE = "forms.entryTypeFile";

Expand Down Expand Up @@ -226,14 +223,12 @@ private Step createStep( )
*/
private Entry createEntry( )
{
EntryType entryTypeText = new EntryType( );
entryTypeText.setIdType( ENTRY_TYPE_FILE_ID );
entryTypeText.setTitle( ENTRY_TYPE_TITLE );
entryTypeText.setBeanName( BEAN_NAME_ENTRY_TYPE_FILE );
List<EntryType> entryTypes = EntryTypeHome.getCompleteList( );
EntryType entryTypeFile = entryTypes.stream().filter( type -> BEAN_NAME_ENTRY_TYPE_FILE.equals( type.getBeanName( ) ) ).findFirst( ).orElse( null );

Entry entry = new Entry( );
entry.setIndexed( true );
entry.setEntryType( entryTypeText );
entry.setEntryType( entryTypeFile );
entry.setResourceType( RESOURCE_TYPE );
entry.setIdResource( _form.getId( ) );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,16 @@ public class FormsEntryUtilsTest extends LuteceTestCase {

private static final int ENTRY_TYPE_TEXT_ID = 106;
private static final String ENTRY_TYPE_TITLE = "default_entry_type_title";

private static final String BEAN_NAME_ENTRY_TYPE_NUMBER = "forms.entryTypeNumber";
private static final String BEAN_NAME_ENTRY_TYPE_TEXT = "forms.entryTypeText";


public void testCreateEntryByType() {
List<EntryType> entryTypes = FormsEntryUtils.initListEntryType();
EntryType entryTypeNumber = entryTypes.stream().filter( type -> BEAN_NAME_ENTRY_TYPE_NUMBER.equals( type.getBeanName( ) ) ).findFirst( ).orElse( null );
assertNotNull(entryTypeNumber);

Entry entryByType = FormsEntryUtils.createEntryByType(120);
Entry entryByType = FormsEntryUtils.createEntryByType(entryTypeNumber.getIdType());
assertNotNull(entryByType);
EntryType entryType = entryByType.getEntryType();
assertNotNull(entryType);
Expand All @@ -80,7 +83,7 @@ public void testGetIndexFieldInTheFieldList() {

public void testInitRefListEntryType() {
ReferenceList referenceItems = FormsEntryUtils.initRefListEntryType();
assertEquals(18, referenceItems.size());
assertEquals(22, referenceItems.size());
}

public void testInitListEntryType() {
Expand Down