@@ -0,0 +1,3205 @@
+package etomica;%0A%0Aimport etomica.integrator.Integrator;%0Aimport etomica.normalmode.NormalModeAnalysisDisplay2D;%0Aimport etomica.normalmode.NormalModeAnalysisDisplay3D;%0Aimport etomica.simulation.Simulation;%0Aimport etomica.space.Space;%0Aimport etomica.space3d.Space3D;%0Aimport org.junit.jupiter.api.Assertions;%0Aimport org.junit.jupiter.api.Assumptions;%0Aimport org.junit.jupiter.params.ParameterizedTest;%0Aimport org.junit.jupiter.params.provider.Arguments;%0Aimport org.junit.jupiter.params.provider.MethodSource;%0A%0Aimport java.lang.reflect.Constructor;%0Aimport java.lang.reflect.Field;%0Aimport java.lang.reflect.InvocationTargetException;%0Aimport java.util.ArrayList;%0Aimport java.util.Arrays;%0Aimport java.util.List;%0Aimport java.util.concurrent.ExecutorService;%0Aimport java.util.concurrent.Executors;%0Aimport java.util.concurrent.Future;%0Aimport java.util.stream.Collectors;%0Aimport java.util.stream.Stream;%0A%0Aimport static etomica.TestSimConstructors.SCAN;%0A%0Apublic class TestSimShortRuns %7B%0A    private static final ExecutorService exec = Executors.newSingleThreadExecutor();%0A%0A    static List%3CArguments%3E getIntegrators() throws IllegalAccessException, InstantiationException, InvocationTargetException %7B%0A        // This beautiful method will search through constructible simulations looking for ones%0A        // with one and only one field of type Integrator (getIntegrator isn't reliable, and with%0A        // more than one we don't know which one to use), instantiate the simulations, and return the integrators.%0A        List%3CClass%3C?%3E%3E classes =  SCAN.classNamesToClassRefs(SCAN.getNamesOfSubclassesOf(Simulation.class));%0A        List%3CArguments%3E args = new ArrayList%3C%3E();%0A%0A        for (Class%3C?%3E cl : classes) %7B%0A            if (cl == NormalModeAnalysisDisplay3D.class) continue;%0A            Field%5B%5D fields = cl.getDeclaredFields();%0A            List%3CField%3E integratorFields = Arrays.stream(fields)%0A                    .filter(f -%3E Integrator.class.isAssignableFrom(f.getType()))%0A                    .collect(Collectors.toList());%0A%0A            if (integratorFields.size() == 1) %7B%0A                Simulation sim = null;%0A                try %7B%0A                    sim = (Simulation) cl.getConstructor().newInstance();%0A                %7D catch (NoSuchMethodException e) %7B%0A                    try %7B%0A                        sim = (Simulation) cl.getConstructor(Space.class).newInstance(Space3D.getInstance());%0A                    %7D catch (NoSuchMethodException e1) %7B%0A                        continue;%0A                    %7D%0A                %7D%0A%0A                integratorFields.get(0).setAccessible(true);%0A                args.add(Arguments.of(cl, (Integrator)integratorFields.get(0).get(sim)));%0A            %7D%0A        %7D%0A%0A        System.out.println(args);%0A        return args;%0A    %7D%0A%0A    @ParameterizedTest%0A    @MethodSource(%22getIntegrators%22)%0A    void testShortRuns(Class%3C?%3E simClass, Integrator simIntegrator) %7B%0A        Assertions.assertDoesNotThrow(() -%3E %7B%0A            simIntegrator.reset();%0A            Future future = exec.submit(() -%3E %7B%0A                while (true) %7B%0A                    simIntegrator.doStep();%0A                %7D%0A            %7D);%0A            Thread.sleep(1000);%0A            future.cancel(true);%0A        %7D);%0A    %7D%0A%7D%0A

Add test which runs all sims to check they don't crash