### Question:
MySqlDefaultChanger implements DebugSection { @VisibleForTesting Connection getConnection(MySQL mySql) { try { Method method = MySQL.class.getDeclaredMethod("getConnection"); method.setAccessible(true); return (Connection) method.invoke(mySql); } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { throw new IllegalStateException("Could not get MySQL connection", e); } }  @Override String getName(); @Override String getDescription(); @Override PermissionNode getRequiredPermission(); @Override void execute(CommandSender sender, List<String> arguments);  }### Answer:
@Test public void shouldReturnMySqlConnection() throws SQLException { Settings settings = mock(Settings.class); TestHelper.returnDefaultsForAllProperties(settings); HikariDataSource dataSource = mock(HikariDataSource.class); Connection connection = mock(Connection.class); given(dataSource.getConnection()).willReturn(connection); MySQL mySQL = SqlDataSourceTestUtil.createMySql(settings, dataSource); MySqlDefaultChanger defaultChanger = createDefaultChanger(mySQL); Connection result = defaultChanger.getConnection(mySQL); assertThat(result, equalTo(connection)); verify(dataSource).getConnection(); }