/** * Creates a new actor in the current model. If an actor with the specified name * already exists, returns the existing actor. * * @param actorName * the name of the existing actor / actor to be created. * @return the created / found actor. */ public Actor actor(String actorName) { Actor actor = model.hasActor(actorName) ? model.findActor(actorName) : model.newActor(actorName); return actor; }
@Test public void createsSingleStepThatPerformsSystemReactionAutomaticallyForSpecificActor() { UseCasePart useCasePart = modelBuilder.useCase(USE_CASE); Model model = useCasePart.basicFlow() .step(SYSTEM_DISPLAYS_TEXT).as(customer).system(displaysConstantText()) .build(); Collection<Step> steps = useCasePart.getUseCase().getSteps(); assertEquals(1, steps.size()); Step step = steps.iterator().next(); assertEquals(SYSTEM_DISPLAYS_TEXT, step.getName()); assertEquals(USE_CASE, step.getUseCase().getName()); assertTrue(model.hasActor(customer.getName())); assertEquals(customer, step.getActors()[0]); }