use of org.talend.dataprofiler.ecos.model.IEcosComponent in project tdq-studio-se by Talend.
the class ImportObjectTest method testExtractImportObject.
/**
* Test method for
* {@link org.talend.dataprofiler.core.ui.action.actions.ImportObject#extractImportObject(org.talend.dataprofiler.ecos.model.IEcosComponent, java.util.List)}
* .
*/
@Test
public void testExtractImportObject() {
try {
IEcosComponent ecosMock = mock(IEcosComponent.class);
PowerMockito.mockStatic(ComponentInstaller.class);
File fileMock = mock(File.class);
when(ComponentInstaller.unzip(anyString(), anyString())).thenReturn(fileMock);
PowerMockito.mockStatic(FilesUtils.class);
List<File> objFiles = new ArrayList<File>();
File objFileMock = mock(File.class);
objFiles.add(objFileMock);
List<File> jarFiles = new ArrayList<File>();
File jarFileMock = mock(File.class);
jarFiles.add(jarFileMock);
when(FilesUtils.getAllFilesFromFolder((File) anyObject(), (FilenameFilter) anyObject())).thenReturn(objFiles).thenReturn(jarFiles);
List<ReturnCode> information = new ArrayList<ReturnCode>();
List<ImportObject> importObjects = ImportObject.extractImportObject(ecosMock, information);
assertEquals(importObjects.size(), 1);
assertEquals(information.size(), 0);
} catch (Exception e) {
fail(e.getMessage());
}
}
use of org.talend.dataprofiler.ecos.model.IEcosComponent in project tdq-studio-se by Talend.
the class ImportObjectTest method testExtractImportObject2.
/**
* Test method for
* {@link org.talend.dataprofiler.core.ui.action.actions.ImportObject#extractImportObject(org.talend.dataprofiler.ecos.model.IEcosComponent, java.util.List)}
* .
*/
@Test
public void testExtractImportObject2() {
try {
IEcosComponent ecosMock = mock(IEcosComponent.class);
PowerMockito.mockStatic(ComponentInstaller.class);
File fileMock = mock(File.class);
when(ComponentInstaller.unzip(anyString(), anyString())).thenReturn(fileMock);
PowerMockito.mockStatic(FilesUtils.class);
List<File> objFiles = new ArrayList<File>();
when(FilesUtils.getAllFilesFromFolder((File) anyObject(), (FilenameFilter) anyObject())).thenReturn(objFiles);
List<ReturnCode> information = new ArrayList<ReturnCode>();
List<ImportObject> importObjects = ImportObject.extractImportObject(ecosMock, information);
assertEquals(importObjects.size(), 0);
assertEquals(information.size(), 1);
} catch (Exception e) {
fail(e.getMessage());
}
}
Aggregations