@Test public void acceptContext_false() { when(bpmnDiagramService.getProjectType(rootPath)).thenReturn(ProjectType.BPMN); tested.acceptContext(callback); verify(bpmnDiagramService).getProjectType(rootPath); verify(callback, never()).onSuccess(anyBoolean()); }
public void acceptContext(final Callback<Boolean, Void> callback) { projectContext.getActiveWorkspaceProject() .map(WorkspaceProject::getRootPath) .ifPresent(path -> bpmnDiagramService.call( projectType -> Optional.ofNullable(projectType) .filter(ProjectType.CASE::equals) .ifPresent(p -> callback.onSuccess(true))) .getProjectType(path)); }
CaseHelper { public void acceptContext(final Callback<Boolean, Void> callback) { projectContext.getActiveWorkspaceProject() .map(WorkspaceProject::getRootPath) .ifPresent(path -> bpmnDiagramService.call( projectType -> Optional.ofNullable(projectType) .filter(ProjectType.CASE::equals) .ifPresent(p -> callback.onSuccess(true))) .getProjectType(path)); } }
CaseHelper { public void acceptContext(final Callback<Boolean, Void> callback) { projectContext.getActiveWorkspaceProject() .map(WorkspaceProject::getRootPath) .ifPresent(path -> bpmnDiagramService.call( projectType -> Optional.ofNullable(projectType) .filter(ProjectType.CASE::equals) .ifPresent(p -> callback.onSuccess(true))) .getProjectType(path)); } @Inject  CaseHelper(final Caller<BPMNDiagramService> bpmnDiagramService,
                      final WorkspaceProjectContext projectContext); }
CaseHelper { public void acceptContext(final Callback<Boolean, Void> callback) { projectContext.getActiveWorkspaceProject() .map(WorkspaceProject::getRootPath) .ifPresent(path -> bpmnDiagramService.call( projectType -> Optional.ofNullable(projectType) .filter(ProjectType.CASE::equals) .ifPresent(p -> callback.onSuccess(true))) .getProjectType(path)); } @Inject  CaseHelper(final Caller<BPMNDiagramService> bpmnDiagramService,
                      final WorkspaceProjectContext projectContext); void acceptContext(final Callback<Boolean, Void> callback); }
CaseHelper { public void acceptContext(final Callback<Boolean, Void> callback) { projectContext.getActiveWorkspaceProject() .map(WorkspaceProject::getRootPath) .ifPresent(path -> bpmnDiagramService.call( projectType -> Optional.ofNullable(projectType) .filter(ProjectType.CASE::equals) .ifPresent(p -> callback.onSuccess(true))) .getProjectType(path)); } @Inject  CaseHelper(final Caller<BPMNDiagramService> bpmnDiagramService,
                      final WorkspaceProjectContext projectContext); void acceptContext(final Callback<Boolean, Void> callback);  }