Skip to content

Commit

Permalink
LPD-41872 Add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
carolmariaabb authored and brianchandotcom committed Nov 12, 2024
1 parent 4880263 commit 1f1804e
Showing 1 changed file with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@
import com.liferay.portal.kernel.test.util.TestPropsValues;
import com.liferay.portal.kernel.util.LocaleUtil;
import com.liferay.portal.odata.entity.EntityField;
import com.liferay.portal.vulcan.util.LocalizedMapUtil;

import java.util.Collections;
import java.util.Locale;
import java.util.Map;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
Expand Down Expand Up @@ -101,6 +105,36 @@ public void testGraphQLGetListTypeEntry() throws Exception {
public void testGraphQLGetListTypeEntryNotFound() throws Exception {
}

@Override
@Test
public void testPostListTypeDefinitionListTypeEntry() throws Exception {
super.testPostListTypeDefinitionListTypeEntry();

ListTypeEntry listTypeEntry = randomListTypeEntry();

listTypeEntry.setName(RandomTestUtil.randomString());
listTypeEntry.setName_i18n((Map<String, String>)null);

_assertListTypeEntryNameLocalizedMap(
testPostListTypeDefinitionListTypeEntry_addListTypeEntry(
listTypeEntry));
}

@Override
@Test
public void testPutListTypeEntry() throws Exception {
super.testPutListTypeEntry();

ListTypeEntry listTypeEntry = testPutListTypeEntry_addListTypeEntry();

listTypeEntry.setName(RandomTestUtil.randomString());
listTypeEntry.setName_i18n((Map<String, String>)null);

_assertListTypeEntryNameLocalizedMap(
listTypeEntryResource.putListTypeEntry(
listTypeEntry.getId(), listTypeEntry));
}

@Override
protected ListTypeEntry randomListTypeEntry() throws Exception {
ListTypeEntry listTypeEntry = super.randomListTypeEntry();
Expand Down Expand Up @@ -182,6 +216,17 @@ private ListTypeEntry _addListTypeEntry() throws Exception {
randomListTypeEntry());
}

private void _assertListTypeEntryNameLocalizedMap(
ListTypeEntry listTypeEntry) {

Map<Locale, String> nameLocalizedMap = LocalizedMapUtil.getLocalizedMap(
listTypeEntry.getName_i18n());

Assert.assertEquals(
listTypeEntry.getName(),
nameLocalizedMap.get(LocaleUtil.getSiteDefault()));
}

@DeleteAfterTestRun
private ListTypeDefinition _listTypeDefinition;

Expand Down

0 comments on commit 1f1804e

Please sign in to comment.