@Test public void testFailedLayoutExport() throws Exception { LayoutExporter layoutExporter = LayoutExporter.getInstance(); Map<String, Serializable> settingsMap = ExportImportConfigurationSettingsMapFactory.buildSettingsMap( TestPropsValues.getUserId(), 0, false, new long[0], _parameterMap, Locale.US, TimeZoneUtil.GMT); ExportImportConfiguration exportImportConfiguration = ExportImportConfigurationLocalServiceUtil.addExportImportConfiguration( TestPropsValues.getUserId(), 0, RandomTestUtil.randomString(), StringPool.BLANK, ExportImportConfigurationConstants.TYPE_EXPORT_LAYOUT, settingsMap, WorkflowConstants.STATUS_DRAFT, ServiceContextTestUtil.getServiceContext()); try { layoutExporter.exportLayoutsAsFile(exportImportConfiguration); Assert.fail(); } catch (NoSuchGroupException nsge) { Assert.assertEquals("No Group exists with the primary key 0", nsge.getMessage()); } Assert.assertTrue( _firedExportImportLifecycleEventsMap.containsKey( ExportImportLifecycleConstants.EVENT_LAYOUT_EXPORT_FAILED)); }