### Question:
AbstractSideBySideDiffPresentation extends AbstractDiffPresentation { @Override public void execute() { final ISession sourceSession = sessionInfoProvider.getSourceSession(); final IScriptFileManager scriptFileManager = sessionInfoProvider.getScriptFileManager(); final IDatabaseObjectInfo[] selectedDestObjects = sessionInfoProvider.getDestSelectedDatabaseObjects(); final ISession destSession = sessionInfoProvider.getDestSession(); final IDatabaseObjectInfo[] selectedSourceObjects = sessionInfoProvider.getSourceSelectedDatabaseObjects(); final HibernateDialect dialect = dialectFactory.getDialect(sourceSession.getMetaData()); final CreateScriptPreferences csprefs = new CreateScriptPreferences(); final List<ITableInfo> sourcetables = convertArrayToList(selectedSourceObjects); final List<ITableInfo> desttables = convertArrayToList(selectedDestObjects); try { final String script1 = constructScriptFromList(dialect.getCreateTableSQL(sourcetables, sourceSession.getMetaData(), csprefs, false, preferenceBean.isSortColumnsForSideBySideComparison())); final String script2 = constructScriptFromList(dialect.getCreateTableSQL(desttables, destSession.getMetaData(), csprefs, false, preferenceBean.isSortColumnsForSideBySideComparison())); final String sourceFilename = scriptFileManager.getOutputFilenameForSession(sourceSession, 1); final String destFilename = scriptFileManager.getOutputFilenameForSession(destSession, 2); writeScriptToFile(script1, sourceFilename); writeScriptToFile(script2, destFilename); executeDiff(sourceFilename, destFilename); } catch (final Exception e) { s_log.error("Unexpected exception while generating sql scripts : " + e.getMessage(), e); } }  @Override void execute(); void setFileWrapperFactory(FileWrapperFactory fileWrapperFactory); void setIoutils(IOUtilities ioutils); void setDialectFactory(IDialectFactory dialectFactory);  }### Answer:
@Test @SuppressWarnings("unchecked") public void testExecute() throws SQLException { classUnderTest.setFileWrapperFactory(mockFileWrapperFactory); classUnderTest.setIoutils(mockIoUtilities); classUnderTest.setSessionInfoProvider(mockSessionInfoProvider); classUnderTest.setDialectFactory(mockDialectFactory); when(mockSessionInfoProvider.getSourceSession()).thenReturn(mockSourceSession); when(mockSessionInfoProvider.getDestSession()).thenReturn(mockDestSession); when(mockSessionInfoProvider.getSourceSelectedDatabaseObjects()).thenReturn(mockSourceSelectedObjects); when(mockSessionInfoProvider.getDestSelectedDatabaseObjects()).thenReturn(mockDestSelectedObjects); when(mockSessionInfoProvider.getScriptFileManager()).thenReturn(mockScriptFileManager); when(mockSourceSession.getMetaData()).thenReturn(mockSourceDatabaseMetaData); when(mockDestSession.getMetaData()).thenReturn(mockDestDatabaseMetaData); when(mockDialectFactory.getDialect(mockSourceDatabaseMetaData)).thenReturn(mockHibernateDialect); when(mockDialectFactory.getDialect(mockDestDatabaseMetaData)).thenReturn(mockHibernateDialect); final List<String> createScript = new ArrayList<String>(); createScript.add("create table test ( myid integere, mydesc varchar(100));"); when( mockHibernateDialect.getCreateTableSQL(anyList(), eq(mockSourceDatabaseMetaData), (CreateScriptPreferences) any(), eq(false))).thenReturn(createScript); when( mockHibernateDialect.getCreateTableSQL(anyList(), eq(mockDestDatabaseMetaData), (CreateScriptPreferences) any(), eq(false))).thenReturn(createScript); classUnderTest.execute(); }