ScenarioSimulationServiceImpl extends KieService<ScenarioSimulationModelContent> implements ScenarioSimulationService { protected void createActivatorIfNotExist(Path context) { KieModule kieModule = kieModuleService.resolveModule(context); Package junitActivatorPackage = getOrCreateJunitActivatorPackage(kieModule); final org.uberfire.java.nio.file.Path activatorPath = getActivatorPath(junitActivatorPackage); boolean needMigrateActivatorIfExists = ensureDependencies(kieModule); if (needMigrateActivatorIfExists || !ioService.exists(activatorPath)) { removeOldActivatorIfExists(activatorPath, kieModule); ioService.write(activatorPath, ScenarioJunitActivator.ACTIVATOR_CLASS_CODE.apply(JUNIT_ACTIVATOR_PACKAGE_NAME), commentedOptionFactory.makeCommentedOption("")); } } ScenarioSimulationServiceImpl(); @Inject  ScenarioSimulationServiceImpl(final SessionInfo sessionInfo); @PostConstruct void init(); @Override SimulationRunResult runScenario(final Path path,
                                           final ScesimModelDescriptor simulationDescriptor,
                                           final List<ScenarioWithIndex> scenarios,
                                           final Settings settings,
                                           final Background background); @Override Path create(final Path context,
                       final String fileName,
                       final ScenarioSimulationModel content,
                       final String comment); @Override Path create(Path context, String fileName, ScenarioSimulationModel content, String comment, Type type, String value); @Override ScenarioSimulationModel load(final Path path); @Override Path save(final Path resource,
                     final ScenarioSimulationModel content,
                     final Metadata metadata,
                     final String comment); @Override void delete(final Path path,
                       final String comment); @Override Path rename(final Path path,
                       final String newName,
                       final String comment); @Override Path copy(final Path path,
                     final String newName,
                     final String comment); @Override Path copy(final Path path,
                     final String newName,
                     final Path targetDirectory,
                     final String comment); @Override Path saveAndRename(final Path path,
                              final String newFileName,
                              final Metadata metadata,
                              final ScenarioSimulationModel content,
                              final String comment); @Override List<FactMappingValidationError> validate(Simulation simulation, Settings settings, Path path);  }
@Test public void createActivatorIfNotExistTest() { service.createActivatorIfNotExist(path); verify(ioServiceMock, times(1)) .write(any(org.uberfire.java.nio.file.Path.class), anyString(), any(OpenOption.class)); reset(ioServiceMock); when(ioServiceMock.exists(any())).thenReturn(true); service.createActivatorIfNotExist(path); verify(ioServiceMock, never()) .write(any(org.uberfire.java.nio.file.Path.class), anyString(), any(OpenOption.class)); }