use of org.pentaho.di.ui.spoon.delegates.SpoonTabsDelegate in project pentaho-kettle by pentaho.
the class SpoonTest method prepareSetShellTextTests.
private static Shell prepareSetShellTextTests(Spoon spoon, AbstractMeta abstractMeta, boolean versionEnabled, boolean isTransformation, boolean repIsNull, boolean revIsNull, boolean hasChanged, boolean nameIsNull, boolean filenameIsNull, boolean tabNameIsNull) {
Shell mockShell = mock(Shell.class);
ObjectRevision mockObjectRevision = revIsNull ? null : mock(ObjectRevision.class);
RepositoryDirectory mockRepDirectory = mock(RepositoryDirectory.class);
Repository mockRepository = repIsNull ? null : mock(Repository.class);
RepositorySecurityProvider mockRepSecurityProvider = mock(RepositorySecurityProvider.class);
SpoonDelegates mockDelegate = mock(SpoonDelegates.class);
SpoonTabsDelegate mockDelegateTabs = mock(SpoonTabsDelegate.class);
spoon.rep = mockRepository;
spoon.delegates = mockDelegate;
mockDelegate.tabs = mockDelegateTabs;
doCallRealMethod().when(spoon).openSpoon();
doCallRealMethod().when(spoon).setShellText();
doReturn(mockShell).when(spoon).getShell();
if (!tabNameIsNull) {
doReturn("tabName").when(spoon).getActiveTabText();
}
doReturn(false).when(mockShell).isDisposed();
setTransJobValues(abstractMeta, spoon, mockObjectRevision, mockRepDirectory, isTransformation, hasChanged, nameIsNull, filenameIsNull);
if (!revIsNull) {
doReturn("1.0").when(mockObjectRevision).getName();
}
doReturn("/admin").when(mockRepDirectory).getPath();
Mockito.doReturn(null).when(abstractMeta).getVersioningEnabled();
if (!repIsNull) {
doReturn(mockRepSecurityProvider).when(mockRepository).getSecurityProvider();
doReturn(versionEnabled).when(mockRepSecurityProvider).isVersioningEnabled(anyString());
}
doReturn("RepositoryName").when(spoon).getRepositoryName();
doReturn(new ArrayList<TabMapEntry>()).when(mockDelegateTabs).getTabs();
try {
spoon.openSpoon();
} catch (NullPointerException e) {
// ignore work is done
}
spoon.setShellText();
return mockShell;
}
Aggregations