Search in sources :

Example 56 with Mock

use of org.mockito.Mock in project kie-wb-common by kiegroup.

the class GeneralSettingsPresenterTest method testExecuteValidationFailing.

@Test
public void testExecuteValidationFailing() {
    final POM pom = mock(POM.class);
    doReturn(false).when(validationService).validate(eq(pom));
    generalSettingsPresenter.executeValidation(s -> s.validate(pom), "Test message").then(valid -> {
        Assert.fail("Promise should've been resolved!");
        return promises.resolve();
    }).catch_(e -> {
        verify(validationService).validate(eq(pom));
        Assert.assertEquals(e, "Test message");
        return promises.resolve();
    });
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) GAVPreferences(org.guvnor.common.services.project.preferences.GAVPreferences) CallerMock(org.uberfire.mocks.CallerMock) Mock(org.mockito.Mock) Promises(org.uberfire.client.promise.Promises) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) GAV(org.guvnor.common.services.project.model.GAV) RunWith(org.junit.runner.RunWith) PreferenceScopeResolutionStrategyInfo(org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo) ProjectScopedResolutionStrategySupplier(org.guvnor.common.services.project.client.preferences.ProjectScopedResolutionStrategySupplier) Mockito.spy(org.mockito.Mockito.spy) SettingsSectionChange(org.kie.workbench.common.screens.library.client.settings.SettingsSectionChange) GitUrlsPresenter(org.kie.workbench.common.screens.library.client.settings.generalsettings.GitUrlsPresenter) LibraryPlaces(org.kie.workbench.common.screens.library.client.util.LibraryPlaces) POM(org.guvnor.common.services.project.model.POM) WorkspaceProject(org.guvnor.common.services.project.model.WorkspaceProject) SyncPromises(org.uberfire.promise.SyncPromises) Mockito.doReturn(org.mockito.Mockito.doReturn) Before(org.junit.Before) OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) ValidationService(org.kie.workbench.common.services.shared.validation.ValidationService) ProjectScreenModel(org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel) Test(org.junit.Test) Mockito.doNothing(org.mockito.Mockito.doNothing) Mockito.when(org.mockito.Mockito.when) WorkspaceProjectService(org.guvnor.common.services.project.service.WorkspaceProjectService) MenuItem(org.kie.workbench.common.screens.library.client.settings.util.sections.MenuItem) Mockito.verify(org.mockito.Mockito.verify) Mockito(org.mockito.Mockito) Mockito.never(org.mockito.Mockito.never) Caller(org.jboss.errai.common.client.api.Caller) EventSourceMock(org.uberfire.mocks.EventSourceMock) Assert(org.junit.Assert) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) Mockito.mock(org.mockito.Mockito.mock) POM(org.guvnor.common.services.project.model.POM) Test(org.junit.Test)

Example 57 with Mock

use of org.mockito.Mock in project kie-wb-common by kiegroup.

the class GeneralSettingsPresenterTest method testExecuteValidation.

@Test
public void testExecuteValidation() {
    final POM pom = mock(POM.class);
    doReturn(true).when(validationService).validate(eq(pom));
    generalSettingsPresenter.executeValidation(s -> s.validate(pom), "Test message").then(valid -> {
        verify(validationService).validate(eq(pom));
        Assert.assertEquals(valid, true);
        return promises.resolve();
    }).catch_(e -> {
        Assert.fail("Promise should've been resolved!");
        return promises.resolve();
    });
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) GAVPreferences(org.guvnor.common.services.project.preferences.GAVPreferences) CallerMock(org.uberfire.mocks.CallerMock) Mock(org.mockito.Mock) Promises(org.uberfire.client.promise.Promises) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) GAV(org.guvnor.common.services.project.model.GAV) RunWith(org.junit.runner.RunWith) PreferenceScopeResolutionStrategyInfo(org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo) ProjectScopedResolutionStrategySupplier(org.guvnor.common.services.project.client.preferences.ProjectScopedResolutionStrategySupplier) Mockito.spy(org.mockito.Mockito.spy) SettingsSectionChange(org.kie.workbench.common.screens.library.client.settings.SettingsSectionChange) GitUrlsPresenter(org.kie.workbench.common.screens.library.client.settings.generalsettings.GitUrlsPresenter) LibraryPlaces(org.kie.workbench.common.screens.library.client.util.LibraryPlaces) POM(org.guvnor.common.services.project.model.POM) WorkspaceProject(org.guvnor.common.services.project.model.WorkspaceProject) SyncPromises(org.uberfire.promise.SyncPromises) Mockito.doReturn(org.mockito.Mockito.doReturn) Before(org.junit.Before) OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) ValidationService(org.kie.workbench.common.services.shared.validation.ValidationService) ProjectScreenModel(org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel) Test(org.junit.Test) Mockito.doNothing(org.mockito.Mockito.doNothing) Mockito.when(org.mockito.Mockito.when) WorkspaceProjectService(org.guvnor.common.services.project.service.WorkspaceProjectService) MenuItem(org.kie.workbench.common.screens.library.client.settings.util.sections.MenuItem) Mockito.verify(org.mockito.Mockito.verify) Mockito(org.mockito.Mockito) Mockito.never(org.mockito.Mockito.never) Caller(org.jboss.errai.common.client.api.Caller) EventSourceMock(org.uberfire.mocks.EventSourceMock) Assert(org.junit.Assert) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) Mockito.mock(org.mockito.Mockito.mock) POM(org.guvnor.common.services.project.model.POM) Test(org.junit.Test)

Example 58 with Mock

use of org.mockito.Mock in project kie-wb-common by kiegroup.

the class JavaRoasterModelDriverTest method modelReadTest.

@Test
public void modelReadTest() {
    try {
        final SourceFilter pojo1Filter = javaType -> false;
        final NestedClassFilter nestedClassFilter = javaType -> javaType.isClass() && javaType.getAnnotation(Generated.class) != null;
        final MethodFilter methodFilter = method -> !method.isConstructor() && method.getAnnotation(Generated.class) != null;
        FilterHolder filterHolder = mock(FilterHolder.class);
        when(filterHolder.getSourceFilters()).thenReturn(Collections.singleton(pojo1Filter));
        when(filterHolder.getNestedClassFilters()).thenReturn(Collections.singleton(nestedClassFilter));
        when(filterHolder.getMethodFilters()).thenReturn(Collections.singleton(methodFilter));
        JavaRoasterModelDriver javaRoasterModelDriver = new JavaRoasterModelDriver(ioService, rootPath, getClass().getClassLoader(), filterHolder);
        ModelDriverResult modelDriverResult = javaRoasterModelDriver.loadModel();
        DataModel dataModelOriginal = createModel();
        assertNotNull(modelDriverResult);
        assertNotNull(modelDriverResult.getDataModel());
        assertEquals(dataModelOriginal.getDataObjects().size(), modelDriverResult.getDataModel().getDataObjects().size());
        for (DataObject dataObject : dataModelOriginal.getDataObjects()) {
            DataModelerAssert.assertEqualsDataObject(dataObject, modelDriverResult.getDataModel().getDataObject(dataObject.getClassName()));
        }
        for (JavaEnum javaEnum : dataModelOriginal.getJavaEnums()) {
            DataModelerAssert.assertEqualsJavaEnum(javaEnum, modelDriverResult.getDataModel().getJavaEnum(javaEnum.getClassName()));
        }
        org.uberfire.backend.vfs.Path errorFile1 = Paths.convert(rootPath.resolve(ERROR_FILE1));
        org.uberfire.backend.vfs.Path errorFile2 = Paths.convert(rootPath.resolve(ERROR_FILE2));
        verifyErrorFilesWereDetected(modelDriverResult, errorFile1, errorFile2);
    } catch (Exception e) {
        e.printStackTrace();
        fail("Test failed: " + e.getMessage());
    }
}
Also used : Description(org.kie.api.definition.type.Description) Arrays(java.util.Arrays) ClassTypeResolver(org.kie.soup.project.datamodel.commons.types.ClassTypeResolver) Timestamp(org.kie.api.definition.type.Timestamp) Label(org.kie.api.definition.type.Label) TestAnnotation1(org.kie.workbench.common.services.datamodeller.parser.test.TestAnnotation1) UpdateInfo(org.kie.workbench.common.services.datamodeller.driver.impl.UpdateInfo) LoggerFactory(org.slf4j.LoggerFactory) DataModelerAssert(org.kie.workbench.common.services.datamodeller.DataModelerAssert) Paths(org.uberfire.backend.server.util.Paths) Generated(javax.annotation.Generated) Matcher(java.util.regex.Matcher) Roaster(org.jboss.forge.roaster.Roaster) ClassAnnotation(org.kie.workbench.common.services.datamodeller.annotations.ClassAnnotation) SequenceGenerator(javax.persistence.SequenceGenerator) SimpleFileSystemProvider(org.uberfire.java.nio.fs.file.SimpleFileSystemProvider) JavaEnum(org.kie.workbench.common.services.datamodeller.core.JavaEnum) URI(java.net.URI) Instance(javax.enterprise.inject.Instance) Entity(javax.persistence.Entity) ParameterImpl(org.kie.workbench.common.services.datamodeller.core.impl.ParameterImpl) UniqueConstraint(javax.persistence.UniqueConstraint) ClassReactive(org.kie.api.definition.type.ClassReactive) JavaTypeInfo(org.kie.workbench.common.services.datamodeller.core.JavaTypeInfo) ENUM3(org.kie.workbench.common.services.datamodeller.annotations.ENUM3) NoSuchFileException(org.uberfire.java.nio.file.NoSuchFileException) List(java.util.List) AnnotationDefinition(org.kie.workbench.common.services.datamodeller.core.AnnotationDefinition) DataModelImpl(org.kie.workbench.common.services.datamodeller.core.impl.DataModelImpl) JavaClassSource(org.jboss.forge.roaster.model.source.JavaClassSource) EnumsAnnotation(org.kie.workbench.common.services.datamodeller.annotations.EnumsAnnotation) AnnotationValuesAnnotation(org.kie.workbench.common.services.datamodeller.annotations.AnnotationValuesAnnotation) Role(org.kie.api.definition.type.Role) JavaClassImpl(org.kie.workbench.common.services.datamodeller.core.impl.JavaClassImpl) PrimitivesAnnotation(org.kie.workbench.common.services.datamodeller.annotations.PrimitivesAnnotation) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) JavaRoasterModelDriver(org.kie.workbench.common.services.datamodeller.driver.impl.JavaRoasterModelDriver) ObjectProperty(org.kie.workbench.common.services.datamodeller.core.ObjectProperty) Expires(org.kie.api.definition.type.Expires) TestAnnotation(org.kie.workbench.common.services.datamodeller.parser.test.TestAnnotation) MarkerAnnotation(org.kie.workbench.common.services.datamodeller.annotations.MarkerAnnotation) Parameter(org.kie.workbench.common.services.datamodeller.core.Parameter) Mock(org.mockito.Mock) Path(org.uberfire.java.nio.file.Path) RunWith(org.junit.runner.RunWith) DriverUtils(org.kie.workbench.common.services.datamodeller.util.DriverUtils) Annotation(org.kie.workbench.common.services.datamodeller.core.Annotation) Type(org.kie.workbench.common.services.datamodeller.core.Type) ArrayList(java.util.ArrayList) Table(javax.persistence.Table) TypeSafe(org.kie.api.definition.type.TypeSafe) Duration(org.kie.api.definition.type.Duration) DataModel(org.kie.workbench.common.services.datamodeller.core.DataModel) Before(org.junit.Before) Logger(org.slf4j.Logger) JavaEnumImpl(org.kie.workbench.common.services.datamodeller.core.impl.JavaEnumImpl) DataObject(org.kie.workbench.common.services.datamodeller.core.DataObject) IOException(java.io.IOException) Test(org.junit.Test) Method(org.kie.workbench.common.services.datamodeller.core.Method) InputStreamReader(java.io.InputStreamReader) File(java.io.File) ImportImpl(org.kie.workbench.common.services.datamodeller.core.impl.ImportImpl) DataObjectImpl(org.kie.workbench.common.services.datamodeller.core.impl.DataObjectImpl) MethodImpl(org.kie.workbench.common.services.datamodeller.core.impl.MethodImpl) Mockito(org.mockito.Mockito) TestEnums(org.kie.workbench.common.services.datamodeller.annotations.TestEnums) AnnotationImpl(org.kie.workbench.common.services.datamodeller.core.impl.AnnotationImpl) Position(org.kie.api.definition.type.Position) JavaClass(org.kie.workbench.common.services.datamodeller.core.JavaClass) TypeImpl(org.kie.workbench.common.services.datamodeller.core.impl.TypeImpl) ModelDriverResult(org.kie.workbench.common.services.datamodeller.driver.model.ModelDriverResult) IOService(org.uberfire.io.IOService) BufferedReader(java.io.BufferedReader) Key(org.kie.api.definition.type.Key) Assert(org.junit.Assert) Collections(java.util.Collections) Visibility(org.kie.workbench.common.services.datamodeller.core.Visibility) InputStream(java.io.InputStream) JavaEnum(org.kie.workbench.common.services.datamodeller.core.JavaEnum) NoSuchFileException(org.uberfire.java.nio.file.NoSuchFileException) IOException(java.io.IOException) DataObject(org.kie.workbench.common.services.datamodeller.core.DataObject) DataModel(org.kie.workbench.common.services.datamodeller.core.DataModel) ModelDriverResult(org.kie.workbench.common.services.datamodeller.driver.model.ModelDriverResult) JavaRoasterModelDriver(org.kie.workbench.common.services.datamodeller.driver.impl.JavaRoasterModelDriver) Test(org.junit.Test)

Example 59 with Mock

use of org.mockito.Mock in project kie-wb-common by kiegroup.

the class JavaRoasterModelDriverTest method importsUpdateTest.

@Test
public void importsUpdateTest() throws Exception {
    Path importsUpdateTestFilePath = rootPath.resolve("package6").resolve("ImportsUpdateTest.java");
    String source = ioService.readAllString(importsUpdateTestFilePath);
    JavaClassSource importsUpdateTestJavaClassSource = (JavaClassSource) Roaster.parse(source);
    ClassLoader classLoader = getClass().getClassLoader();
    ClassTypeResolver classTypeResolver = DriverUtils.createClassTypeResolver(importsUpdateTestJavaClassSource, classLoader);
    final SourceFilter pojo1Filter = javaType -> false;
    final NestedClassFilter nestedClassFilter = javaType -> javaType.isClass() && javaType.getAnnotation(Generated.class) != null;
    final MethodFilter methodFilter = method -> !method.isConstructor() && method.getAnnotation(Generated.class) != null;
    FilterHolder filterHolder = mock(FilterHolder.class);
    when(filterHolder.getSourceFilters()).thenReturn(Collections.singleton(pojo1Filter));
    when(filterHolder.getNestedClassFilters()).thenReturn(Collections.singleton(nestedClassFilter));
    when(filterHolder.getMethodFilters()).thenReturn(Collections.singleton(methodFilter));
    JavaRoasterModelDriver javaRoasterModelDriver = new JavaRoasterModelDriver(ioService, rootPath, classLoader, filterHolder);
    ModelDriverResult result = javaRoasterModelDriver.loadDataObject(source, importsUpdateTestFilePath);
    DataObject importsUpdateTest = result.getDataModel().getDataObject("org.kie.workbench.common.services.datamodeller.driver.package6.ImportsUpdateTest");
    importsUpdateTest.addImport(new ImportImpl(List.class.getName()));
    importsUpdateTest.addImport(new ImportImpl(ArrayList.class.getName()));
    importsUpdateTest.setName("ImportsUpdateTestResult");
    Path expectedFilePath = rootPath.resolve("package6").resolve("ImportsUpdateTestResult.java");
    String expectedSource = ioService.readAllString(expectedFilePath);
    ModelDriverResult expectedResult = javaRoasterModelDriver.loadDataObject(expectedSource, expectedFilePath);
    DataObject importsUpdateTestResult = expectedResult.getDataModel().getDataObject("org.kie.workbench.common.services.datamodeller.driver.package6.ImportsUpdateTestResult");
    DataModelerAssert.assertEqualsDataObject(importsUpdateTestResult, importsUpdateTest);
    DataModelerAssert.assertEqualsImports(importsUpdateTestResult.getImports(), importsUpdateTest.getImports());
    javaRoasterModelDriver.updateSource(importsUpdateTestJavaClassSource, importsUpdateTest, new UpdateInfo(), classTypeResolver);
    ModelDriverResult updatedResult = javaRoasterModelDriver.loadDataObject(importsUpdateTestJavaClassSource.toString(), importsUpdateTestFilePath);
    DataModelerAssert.assertEqualsDataObject(importsUpdateTestResult, updatedResult.getDataModel().getDataObject("org.kie.workbench.common.services.datamodeller.driver.package6.ImportsUpdateTestResult"));
    DataModelerAssert.assertEqualsImports(importsUpdateTestResult.getImports(), updatedResult.getDataModel().getDataObject("org.kie.workbench.common.services.datamodeller.driver.package6.ImportsUpdateTestResult").getImports());
}
Also used : Path(org.uberfire.java.nio.file.Path) Description(org.kie.api.definition.type.Description) Arrays(java.util.Arrays) ClassTypeResolver(org.kie.soup.project.datamodel.commons.types.ClassTypeResolver) Timestamp(org.kie.api.definition.type.Timestamp) Label(org.kie.api.definition.type.Label) TestAnnotation1(org.kie.workbench.common.services.datamodeller.parser.test.TestAnnotation1) UpdateInfo(org.kie.workbench.common.services.datamodeller.driver.impl.UpdateInfo) LoggerFactory(org.slf4j.LoggerFactory) DataModelerAssert(org.kie.workbench.common.services.datamodeller.DataModelerAssert) Paths(org.uberfire.backend.server.util.Paths) Generated(javax.annotation.Generated) Matcher(java.util.regex.Matcher) Roaster(org.jboss.forge.roaster.Roaster) ClassAnnotation(org.kie.workbench.common.services.datamodeller.annotations.ClassAnnotation) SequenceGenerator(javax.persistence.SequenceGenerator) SimpleFileSystemProvider(org.uberfire.java.nio.fs.file.SimpleFileSystemProvider) JavaEnum(org.kie.workbench.common.services.datamodeller.core.JavaEnum) URI(java.net.URI) Instance(javax.enterprise.inject.Instance) Entity(javax.persistence.Entity) ParameterImpl(org.kie.workbench.common.services.datamodeller.core.impl.ParameterImpl) UniqueConstraint(javax.persistence.UniqueConstraint) ClassReactive(org.kie.api.definition.type.ClassReactive) JavaTypeInfo(org.kie.workbench.common.services.datamodeller.core.JavaTypeInfo) ENUM3(org.kie.workbench.common.services.datamodeller.annotations.ENUM3) NoSuchFileException(org.uberfire.java.nio.file.NoSuchFileException) List(java.util.List) AnnotationDefinition(org.kie.workbench.common.services.datamodeller.core.AnnotationDefinition) DataModelImpl(org.kie.workbench.common.services.datamodeller.core.impl.DataModelImpl) JavaClassSource(org.jboss.forge.roaster.model.source.JavaClassSource) EnumsAnnotation(org.kie.workbench.common.services.datamodeller.annotations.EnumsAnnotation) AnnotationValuesAnnotation(org.kie.workbench.common.services.datamodeller.annotations.AnnotationValuesAnnotation) Role(org.kie.api.definition.type.Role) JavaClassImpl(org.kie.workbench.common.services.datamodeller.core.impl.JavaClassImpl) PrimitivesAnnotation(org.kie.workbench.common.services.datamodeller.annotations.PrimitivesAnnotation) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) JavaRoasterModelDriver(org.kie.workbench.common.services.datamodeller.driver.impl.JavaRoasterModelDriver) ObjectProperty(org.kie.workbench.common.services.datamodeller.core.ObjectProperty) Expires(org.kie.api.definition.type.Expires) TestAnnotation(org.kie.workbench.common.services.datamodeller.parser.test.TestAnnotation) MarkerAnnotation(org.kie.workbench.common.services.datamodeller.annotations.MarkerAnnotation) Parameter(org.kie.workbench.common.services.datamodeller.core.Parameter) Mock(org.mockito.Mock) Path(org.uberfire.java.nio.file.Path) RunWith(org.junit.runner.RunWith) DriverUtils(org.kie.workbench.common.services.datamodeller.util.DriverUtils) Annotation(org.kie.workbench.common.services.datamodeller.core.Annotation) Type(org.kie.workbench.common.services.datamodeller.core.Type) ArrayList(java.util.ArrayList) Table(javax.persistence.Table) TypeSafe(org.kie.api.definition.type.TypeSafe) Duration(org.kie.api.definition.type.Duration) DataModel(org.kie.workbench.common.services.datamodeller.core.DataModel) Before(org.junit.Before) Logger(org.slf4j.Logger) JavaEnumImpl(org.kie.workbench.common.services.datamodeller.core.impl.JavaEnumImpl) DataObject(org.kie.workbench.common.services.datamodeller.core.DataObject) IOException(java.io.IOException) Test(org.junit.Test) Method(org.kie.workbench.common.services.datamodeller.core.Method) InputStreamReader(java.io.InputStreamReader) File(java.io.File) ImportImpl(org.kie.workbench.common.services.datamodeller.core.impl.ImportImpl) DataObjectImpl(org.kie.workbench.common.services.datamodeller.core.impl.DataObjectImpl) MethodImpl(org.kie.workbench.common.services.datamodeller.core.impl.MethodImpl) Mockito(org.mockito.Mockito) TestEnums(org.kie.workbench.common.services.datamodeller.annotations.TestEnums) AnnotationImpl(org.kie.workbench.common.services.datamodeller.core.impl.AnnotationImpl) Position(org.kie.api.definition.type.Position) JavaClass(org.kie.workbench.common.services.datamodeller.core.JavaClass) TypeImpl(org.kie.workbench.common.services.datamodeller.core.impl.TypeImpl) ModelDriverResult(org.kie.workbench.common.services.datamodeller.driver.model.ModelDriverResult) IOService(org.uberfire.io.IOService) BufferedReader(java.io.BufferedReader) Key(org.kie.api.definition.type.Key) Assert(org.junit.Assert) Collections(java.util.Collections) Visibility(org.kie.workbench.common.services.datamodeller.core.Visibility) InputStream(java.io.InputStream) JavaClassSource(org.jboss.forge.roaster.model.source.JavaClassSource) DataObject(org.kie.workbench.common.services.datamodeller.core.DataObject) ModelDriverResult(org.kie.workbench.common.services.datamodeller.driver.model.ModelDriverResult) ImportImpl(org.kie.workbench.common.services.datamodeller.core.impl.ImportImpl) ClassTypeResolver(org.kie.soup.project.datamodel.commons.types.ClassTypeResolver) JavaRoasterModelDriver(org.kie.workbench.common.services.datamodeller.driver.impl.JavaRoasterModelDriver) UpdateInfo(org.kie.workbench.common.services.datamodeller.driver.impl.UpdateInfo) Test(org.junit.Test)

Example 60 with Mock

use of org.mockito.Mock in project kie-wb-common by kiegroup.

the class DeleteNodeToolboxActionTest method testSkipAction.

@Test
@SuppressWarnings("unchecked")
public void testSkipAction() {
    this.tested = new DeleteNodeToolboxAction(translationService, sessionCommandManager, commandFactories, definitionUtils, action -> false, clearSelectionEventEventSourceMock);
    final MouseClickEvent event = mock(MouseClickEvent.class);
    final ToolboxAction<AbstractCanvasHandler> cascade = tested.onMouseClick(canvasHandler, E_UUID, event);
    assertEquals(tested, cascade);
    verify(sessionCommandManager, never()).execute(eq(canvasHandler), any(CanvasCommand.class));
    verify(clearSelectionEventEventSourceMock, never()).fire(any(CanvasClearSelectionEvent.class));
}
Also used : GwtMockitoTestRunner(com.google.gwtmockito.GwtMockitoTestRunner) CanvasClearSelectionEvent(org.kie.workbench.common.stunner.core.client.canvas.event.selection.CanvasClearSelectionEvent) DefinitionUtils(org.kie.workbench.common.stunner.core.util.DefinitionUtils) Mock(org.mockito.Mock) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) RunWith(org.junit.runner.RunWith) ClientTranslationService(org.kie.workbench.common.stunner.core.client.i18n.ClientTranslationService) ManagedInstanceStub(org.kie.workbench.common.stunner.core.client.ManagedInstanceStub) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) Before(org.junit.Before) Index(org.kie.workbench.common.stunner.core.graph.processing.index.Index) Test(org.junit.Test) AbstractCanvasHandler(org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler) Mockito.times(org.mockito.Mockito.times) Mockito.when(org.mockito.Mockito.when) SessionCommandManager(org.kie.workbench.common.stunner.core.client.command.SessionCommandManager) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Mockito.verify(org.mockito.Mockito.verify) CanvasCommand(org.kie.workbench.common.stunner.core.client.command.CanvasCommand) MouseClickEvent(org.kie.workbench.common.stunner.core.client.shape.view.event.MouseClickEvent) CoreTranslationMessages(org.kie.workbench.common.stunner.core.i18n.CoreTranslationMessages) Mockito.never(org.mockito.Mockito.never) DefaultCanvasCommandFactory(org.kie.workbench.common.stunner.core.client.canvas.command.DefaultCanvasCommandFactory) EventSourceMock(org.uberfire.mocks.EventSourceMock) Mockito.any(org.mockito.Mockito.any) Node(org.kie.workbench.common.stunner.core.graph.Node) Assert.assertEquals(org.junit.Assert.assertEquals) Mockito.mock(org.mockito.Mockito.mock) CanvasClearSelectionEvent(org.kie.workbench.common.stunner.core.client.canvas.event.selection.CanvasClearSelectionEvent) AbstractCanvasHandler(org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler) MouseClickEvent(org.kie.workbench.common.stunner.core.client.shape.view.event.MouseClickEvent) CanvasCommand(org.kie.workbench.common.stunner.core.client.command.CanvasCommand) Test(org.junit.Test)

Aggregations

Mock (org.mockito.Mock)135 Mockito.mock (org.mockito.Mockito.mock)109 Test (org.junit.Test)104 Before (org.junit.Before)96 Mockito.verify (org.mockito.Mockito.verify)89 Mockito.when (org.mockito.Mockito.when)82 List (java.util.List)81 RunWith (org.junit.runner.RunWith)76 ArgumentMatchers.any (org.mockito.ArgumentMatchers.any)65 Collections (java.util.Collections)56 ArrayList (java.util.ArrayList)55 ArgumentCaptor (org.mockito.ArgumentCaptor)52 Mockito.spy (org.mockito.Mockito.spy)48 Arrays (java.util.Arrays)44 Assert.assertEquals (org.junit.Assert.assertEquals)41 ArgumentMatchers.eq (org.mockito.ArgumentMatchers.eq)41 Mockito.doReturn (org.mockito.Mockito.doReturn)41 Map (java.util.Map)40 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)38 Mockito.never (org.mockito.Mockito.never)37