private CodeRunResult runExecuteMethod(Object object, Method method) {
        CodeRunResult result = new CodeRunResult();

        Runnable runnable = () -> {
            try {
                result.setFailedTestMessages((List<String>) method.invoke(object));
                result.setCompleted(true);
            } catch (Exception e) {
                if (e.getCause() != null) {
                    result.setExceptionMessage(e.getCause().toString());
                } else {
                    result.setExceptionMessage(e.toString());
                }
            }
        };
        Thread thread = new Thread(runnable);
        thread.start();
        try {
            thread.join(2000);
            thread.interrupt();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


        if (!result.isCompleted() && result.getExceptionMessage() == null) {
            result.setExceptionMessage("Submission took too long to run");
        }

        return result;
    }