### Question:
SGATracePanel extends JPanel { public synchronized void populateSGATrace() { if (!OraclePlugin.checkObjectAccessible(_session, sgaTraceSQL)) { return; } PreparedStatement s = null; ResultSet rs = null; try { s = _session.getSQLConnection().getConnection().prepareStatement(sgaTraceSQL); if (s.execute()) { rs = s.getResultSet(); DefaultTableModel tm = createTableModel(); while (rs.next()) { String sqlText = rs.getString(1); String flt = rs.getString(2); String schema = rs.getString(3); String calls = rs.getString(4); String executions = rs.getString(5); String sorts = rs.getString(6); String diskReads = rs.getString(7); String bufGets = rs.getString(8); String rows = rs.getString(9); String sortsExec = rs.getString(10); String diskReadsExec = rs.getString(11); String rowsExec = rs.getString(12); String sortsRows = rs.getString(13); String diskReadsRow = rs.getString(14); String bufGetsRow = rs.getString(15); tm.addRow(new Object[]{sqlText, flt, schema, calls, executions, sorts, diskReads, bufGets, rows, sortsExec, diskReadsExec, rowsExec, sortsRows, diskReadsRow, bufGetsRow}); } _sgaTrace.setModel(tm); if (!hasResized) { hasResized = true; _sgaTrace.resizeColumnWidth(300); } } } catch (SQLException ex) { _session.showErrorMessage(ex); } finally { SQLUtilities.closeResultSet(rs); SQLUtilities.closeStatement(s); } } SGATracePanel(ISession session, int autoRefeshPeriod); ISession getSession(); void setAutoRefresh(boolean enable); boolean getAutoRefesh(); void setAutoRefreshPeriod(int seconds); int getAutoRefreshPeriod(); synchronized void populateSGATrace();  }### Answer:
@Test public void testPopulateSGATrace() throws SQLException { expect(mockSession.getSQLConnection()).andStubReturn(mockSQLConnection); expect(mockSession.getApplication()).andStubReturn(mockApplication); expect(mockSQLConnection.prepareStatement(isA(String.class))).andReturn(mockPreparedStatementForAccessible); expect(mockPreparedStatementForAccessible.executeQuery()).andStubReturn(mockResultSetForAccessible); mockResultSetForAccessible.close(); expect(mockResultSetForAccessible.getStatement()).andStubReturn(mockPreparedStatementForAccessible); mockPreparedStatementForAccessible.close(); expect(mockSQLConnection.getConnection()).andStubReturn(mockConnection); expect(mockConnection.prepareStatement(isA(String.class))).andReturn(mockPreparedStatementForSGATrace); expect(mockPreparedStatementForSGATrace.execute()).andStubReturn(true); expect(mockPreparedStatementForSGATrace.getResultSet()).andStubReturn(mockResultSetForSGATrace); expect(mockResultSetForSGATrace.next()).andReturn(true).andReturn(false); expect(mockResultSetForSGATrace.getString(EasyMock.anyInt())).andStubReturn("testValue"); mockResultSetForSGATrace.close(); expect(mockResultSetForSGATrace.getStatement()).andStubReturn(mockPreparedStatementForSGATrace); mockPreparedStatementForSGATrace.close(); mockHelper.replayAll(); classUnderTest = new SGATracePanel(mockSession, 0); mockHelper.verifyAll(); }