DDMFormInstanceRecordExporterImpl implements DDMFormInstanceRecordExporter { protected List<DDMStructureVersion> getStructureVersions( long ddmFormInstanceId) throws Exception { List<DDMFormInstanceVersion> ddmFormInstanceVersions = ddmFormInstanceVersionLocalService.getFormInstanceVersions( ddmFormInstanceId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); ddmFormInstanceVersions = ListUtil.sort( ddmFormInstanceVersions, new FormInstanceVersionVersionComparator()); List<DDMStructureVersion> ddmStructureVersions = new ArrayList<>(); for (DDMFormInstanceVersion ddmFormInstanceVersion : ddmFormInstanceVersions) { ddmStructureVersions.add( ddmFormInstanceVersion.getStructureVersion()); } return ddmStructureVersions; }  @Override DDMFormInstanceRecordExporterResponse export(
			DDMFormInstanceRecordExporterRequest
				ddmFormInstanceRecordExporterRequest);  }
@Test public void testGetStructureVersions() throws Exception { DDMFormInstanceRecordExporterImpl ddmFormInstanceRecordExporterImpl = new DDMFormInstanceRecordExporterImpl(); ddmFormInstanceRecordExporterImpl.ddmFormInstanceVersionLocalService = _ddmFormInstanceVersionLocalService; List<DDMFormInstanceVersion> ddmFormInstanceVersions = new ArrayList<>(); DDMFormInstanceVersion ddmFormInstanceVersion = mock( DDMFormInstanceVersion.class); ddmFormInstanceVersions.add(ddmFormInstanceVersion); when( _ddmFormInstanceVersionLocalService.getFormInstanceVersions( 1, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null) ).thenReturn( ddmFormInstanceVersions ); DDMStructureVersion ddmStructureVersion = mock( DDMStructureVersion.class); when( ddmFormInstanceVersion.getStructureVersion() ).thenReturn( ddmStructureVersion ); List<DDMStructureVersion> structureVersions = ddmFormInstanceRecordExporterImpl.getStructureVersions(1); Assert.assertEquals(ddmStructureVersion, structureVersions.get(0)); InOrder inOrder = Mockito.inOrder( _ddmFormInstanceVersionLocalService, ddmFormInstanceVersion); inOrder.verify( _ddmFormInstanceVersionLocalService, Mockito.times(1) ).getFormInstanceVersions( 1, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null ); inOrder.verify( ddmFormInstanceVersion, Mockito.times(1) ).getStructureVersion(); }