### Question:
LevelsFactory { public Levels createLevels(String level, Dice dice, FigureQueue playerQueue) { String className = LevelsFactory.class.getPackage().getName() + ".level." + level; try { Class<?> aClass = this.getClass().getClassLoader().loadClass(className); Constructor<?> constructor = aClass.getConstructor(Dice.class, Figures.class); Object result = constructor.newInstance(dice, playerQueue); return (Levels)result; } catch (ReflectiveOperationException e) { throw new RuntimeException("Error during load game levels", e); } }  List<String> allLevels(); Levels createLevels(String level, Dice dice, FigureQueue playerQueue);  }### Answer:
@Test public void shouldLoadClass(){ Levels loaded = factory.createLevels("HardLevels", mock(Dice.class), mock(Figures.class) ); assertEquals(HardLevels.class, loaded.getClass()); }