diff --git a/modules/apps/headless/headless-admin-site/headless-admin-site-test/src/testIntegration/java/com/liferay/headless/admin/site/resource/v1_0/test/WidgetPageWidgetInstanceResourceTest.java b/modules/apps/headless/headless-admin-site/headless-admin-site-test/src/testIntegration/java/com/liferay/headless/admin/site/resource/v1_0/test/WidgetPageWidgetInstanceResourceTest.java index f985f66ba756e0..00623c3d05fb01 100644 --- a/modules/apps/headless/headless-admin-site/headless-admin-site-test/src/testIntegration/java/com/liferay/headless/admin/site/resource/v1_0/test/WidgetPageWidgetInstanceResourceTest.java +++ b/modules/apps/headless/headless-admin-site/headless-admin-site-test/src/testIntegration/java/com/liferay/headless/admin/site/resource/v1_0/test/WidgetPageWidgetInstanceResourceTest.java @@ -205,17 +205,17 @@ protected WidgetPageWidgetInstance randomWidgetPageWidgetInstance() WidgetPageWidgetInstance widgetPageWidgetInstance = new WidgetPageWidgetInstance(); - String widgetName = AssetPublisherPortletKeys.ASSET_PUBLISHER; - String widgetInstanceId = RandomTestUtil.randomString(); + String portletName = AssetPublisherPortletKeys.ASSET_PUBLISHER; - widgetPageWidgetInstance.setExternalReferenceCode( - widgetName + "_INSTANCE_" + widgetInstanceId); + String portletId = PortletIdCodec.encode(portletName); + + widgetPageWidgetInstance.setExternalReferenceCode(portletId); widgetPageWidgetInstance.setParentSectionId("column-1"); widgetPageWidgetInstance.setPosition(_position++); - widgetPageWidgetInstance.setWidgetName(widgetName); - - widgetPageWidgetInstance.setWidgetInstanceId(widgetInstanceId); + widgetPageWidgetInstance.setWidgetInstanceId( + PortletIdCodec.decodeInstanceId(portletId)); + widgetPageWidgetInstance.setWidgetName(portletName); return widgetPageWidgetInstance; }