diff --git a/pom.xml b/pom.xml
index 04a2a60..ecdc295 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,27 +23,11 @@
UTF-8UTF-8
- RELEASE82
+ RELEASE150${netbeans.run.params.ide} -J-Dnetbeans.full.hack=true
-
-
-
- netbeans
- NetBeans
- http://bits.netbeans.org/nexus/content/groups/netbeans
-
- false
-
-
-
-
-
-
- org.netbeans.modules
- org-netbeans-modules-projectapi-nb
- ${netbeans.version}
- test
-
-
-
- org.netbeans.modules
- org-netbeans-modules-parsing-nb
- ${netbeans.version}
- test
- org.netbeans.modules
@@ -360,31 +340,19 @@
org.hamcresthamcrest-all
- 1.3
+ 1.3testjunitjunit
- 4.10
+ 4.13.2testorg.mockito
- mockito-all
- 1.9.5
- test
-
-
- org.powermock
- powermock-module-junit4
- 1.5.1
- test
-
-
- org.powermock
- powermock-api-mockito
- 1.5.1
+ mockito-core
+ 4.8.0test
@@ -421,21 +389,21 @@
- org.codehaus.mojo
+ org.apache.netbeans.utilitiesnbm-maven-plugin
- 4.1
+ 4.8org.apache.maven.pluginsmaven-surefire-plugin
- 2.18.1
+ 3.0.0-M7
- org.codehaus.mojo
+ org.apache.netbeans.utilitiesnbm-maven-plugintrue
@@ -443,7 +411,7 @@
LICENSE.txt
- org.netbeans.modules:org-netbeans-modules-gsf-testrunner
+ org.netbeans.api:org-netbeans-modules-gsf-testrunnerimpl
@@ -457,21 +425,20 @@
org.apache.maven.pluginsmaven-jar-plugin
- 2.4
+ 3.3.0
-
- true
+
+ ${project.build.outputDirectory}/META-INF/MANIFEST.MF
+
-
org.apache.maven.pluginsmaven-compiler-plugin
- 3.1
+ 3.10.1
- 1.8
- 1.8
+ 17true-Xlint:unchecked
@@ -480,7 +447,7 @@
org.codehaus.mojojavacc-maven-plugin
- 2.6
+ 3.0.1generate-parser
@@ -495,14 +462,14 @@
net.java.dev.javaccjavacc
- 7.0.2
+ 7.0.12org.codehaus.mojoexec-maven-plugin
- 1.5.0
+ 3.1.0map-tokens
@@ -525,7 +492,7 @@
org.codehaus.mojobuild-helper-maven-plugin
- 1.9.1
+ 3.3.0compile-build-addon
@@ -568,11 +535,18 @@
maven-surefire-plugin
- -Djava.awt.headless=true -Djna.nosys=true -noverify
+ java.awt.headless=true: Stop tests hijacking UI on development machine
+ jna.nosys=true: Don't try to load JNA from the host system, use our dependency instead (needed for Appveyor, which has an old JNA on it)
+ noverify: Fix for JDK bug with PowerMock
+ -->
+
+ -Djava.awt.headless=true
+ -Djna.nosys=true
+ --add-opens=java.desktop/javax.swing.text=ALL-UNNAMED
+ --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED
+ --add-opens=java.base/java.net=ALL-UNNAMED
+ --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED
+ 1false
@@ -585,7 +559,7 @@
org.apache.maven.pluginsmaven-resources-plugin
- 2.6
+ 3.3.0set-up-unit-test-data
@@ -635,7 +609,7 @@
org.apache.maven.pluginsmaven-failsafe-plugin
- 2.15
+ 3.0.0-M7
@@ -663,7 +637,7 @@
org.apache.maven.pluginsmaven-resources-plugin
- 2.6
+ 3.3.0
@@ -685,9 +659,9 @@
- com.mycila.maven-license-plugin
- maven-license-plugin
- 1.9.0
+ com.mycila
+ license-maven-plugin
+ 4.2.rc3
@@ -746,8 +720,8 @@
org.jasig.maven
- maven-notice-plugin
- 1.0.4
+ notice-maven-plugin
+ 2.0.0license-mappings.xml
diff --git a/src/test/java/com/github/drrb/rust/netbeans/cargo/CargoTest.java b/src/test/java/com/github/drrb/rust/netbeans/cargo/CargoTest.java
index 89b760e..f245faa 100644
--- a/src/test/java/com/github/drrb/rust/netbeans/cargo/CargoTest.java
+++ b/src/test/java/com/github/drrb/rust/netbeans/cargo/CargoTest.java
@@ -16,23 +16,21 @@
*/
package com.github.drrb.rust.netbeans.cargo;
+import static com.github.drrb.rust.netbeans.cargo.Cargo.*;
import com.github.drrb.rust.netbeans.commandrunner.CommandFuture;
import com.github.drrb.rust.netbeans.commandrunner.CommandRunner;
import com.github.drrb.rust.netbeans.commandrunner.HumbleCommandFuture;
import com.github.drrb.rust.netbeans.commandrunner.Shell;
import com.github.drrb.rust.netbeans.configuration.RustConfiguration;
import com.github.drrb.rust.netbeans.project.RustProject;
+import static com.github.drrb.rust.netbeans.test.Matchers.isProcess;
import com.github.drrb.rust.netbeans.test.TemporaryPreferences;
+import java.io.File;
+import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-
-import java.io.File;
-
-import static com.github.drrb.rust.netbeans.cargo.Cargo.*;
-import static com.github.drrb.rust.netbeans.test.Matchers.isProcess;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.argThat;
+import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
diff --git a/src/test/java/com/github/drrb/rust/netbeans/classpath/ClasspathSettingProjectOpenedHookTest.java b/src/test/java/com/github/drrb/rust/netbeans/classpath/ClasspathSettingProjectOpenedHookTest.java
index 07faa25..a8ddbfd 100644
--- a/src/test/java/com/github/drrb/rust/netbeans/classpath/ClasspathSettingProjectOpenedHookTest.java
+++ b/src/test/java/com/github/drrb/rust/netbeans/classpath/ClasspathSettingProjectOpenedHookTest.java
@@ -1,18 +1,13 @@
/**
- * Copyright (C) 2017 drrb
- *
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
+ * Copyright (C) 2017 drrb This program is free software: you can redistribute
+ * it and/or modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details. You should have received a
+ * copy of the GNU General Public License along with this program. If not, see
+ * .
*/
package com.github.drrb.rust.netbeans.classpath;
@@ -26,33 +21,32 @@
import org.hamcrest.TypeSafeMatcher;
import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import static org.mockito.Matchers.argThat;
-import static org.mockito.Matchers.eq;
-import org.mockito.Mock;
+import static org.mockito.ArgumentMatchers.eq;
+import org.mockito.Mockito;
import static org.mockito.Mockito.verify;
+import static org.mockito.hamcrest.MockitoHamcrest.argThat;
import org.netbeans.api.java.classpath.ClassPath;
import org.netbeans.api.java.classpath.GlobalPathRegistry;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
/**
*
*/
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(GlobalPathRegistry.class)
+//
public class ClasspathSettingProjectOpenedHookTest {
private RustProject project;
- @Mock
+
private GlobalPathRegistry globalPathRegistry;
+
private ClasspathSettingProjectOpenedHook hook;
@Before
public void setUp() {
- FileObject projectDirectory = FileUtil.toFileObject(getData("ClasspathSettingProjectOpenedHookTest/testrustproject"));
+ FileObject projectDirectory = FileUtil
+ .toFileObject(getData("ClasspathSettingProjectOpenedHookTest/testrustproject"));
+ globalPathRegistry = Mockito.mock(GlobalPathRegistry.class);
project = new RustProject(projectDirectory, null);
hook = new ClasspathSettingProjectOpenedHook(project, globalPathRegistry);
}
@@ -61,7 +55,8 @@ public void setUp() {
public void shouldRegisterSourceDirectoryAsClasspathRoot() {
hook.projectOpened();
- verify(globalPathRegistry).register(eq(SOURCE_CLASSPATH_ID), argThat(hasItemInArray(classpathWithRootThat(matchesRegex(".*testrustproject/src$")))));
+ verify(globalPathRegistry).register(eq(SOURCE_CLASSPATH_ID),
+ argThat(hasItemInArray(classpathWithRootThat(matchesRegex(".*testrustproject/src$")))));
}
private ClasspathWithRoot classpathWithRootThat(Matcher folder) {
diff --git a/src/test/java/com/github/drrb/rust/netbeans/indexing/IndexItemSerializerTest.java b/src/test/java/com/github/drrb/rust/netbeans/indexing/IndexItemSerializerTest.java
index 2569091..c94a5bb 100644
--- a/src/test/java/com/github/drrb/rust/netbeans/indexing/IndexItemSerializerTest.java
+++ b/src/test/java/com/github/drrb/rust/netbeans/indexing/IndexItemSerializerTest.java
@@ -16,26 +16,17 @@
*/
package com.github.drrb.rust.netbeans.indexing;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import org.netbeans.modules.parsing.spi.indexing.support.IndexDocument;
import org.netbeans.modules.parsing.spi.indexing.support.IndexResult;
import org.openide.filesystems.FileObject;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import static com.github.drrb.rust.netbeans.test.Matchers.is;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.powermock.api.mockito.PowerMockito.mock;
-/**
- *
- */
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({IndexDocument.class, IndexResult.class})
public class IndexItemSerializerTest {
private IndexItemSerializer serializer;
diff --git a/src/test/java/com/github/drrb/rust/netbeans/keypress/RustBracketCompleterTest.java b/src/test/java/com/github/drrb/rust/netbeans/keypress/RustBracketCompleterTest.java
index b3e3f31..66ca9ed 100644
--- a/src/test/java/com/github/drrb/rust/netbeans/keypress/RustBracketCompleterTest.java
+++ b/src/test/java/com/github/drrb/rust/netbeans/keypress/RustBracketCompleterTest.java
@@ -17,27 +17,23 @@
package com.github.drrb.rust.netbeans.keypress;
import com.github.drrb.rust.netbeans.RustDocument;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import org.junit.Test;
-import static org.junit.Assert.*;
import org.junit.Before;
-import org.junit.runner.RunWith;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.anyString;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import org.netbeans.spi.editor.typinghooks.TypedTextInterceptor.Context;
import org.netbeans.spi.editor.typinghooks.TypedTextInterceptor.MutableContext;
-import static org.powermock.api.mockito.PowerMockito.mock;
-import static org.powermock.api.mockito.PowerMockito.when;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
/**
* @todo Try to test this with CslTestBase/golden files instead
*/
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(MutableContext.class)
+
public class RustBracketCompleterTest {
private RustBracketCompleter interceptor;
diff --git a/src/test/java/com/github/drrb/rust/netbeans/project/RustProjectFactoryTest.java b/src/test/java/com/github/drrb/rust/netbeans/project/RustProjectFactoryTest.java
index ec6aa6c..de084eb 100644
--- a/src/test/java/com/github/drrb/rust/netbeans/project/RustProjectFactoryTest.java
+++ b/src/test/java/com/github/drrb/rust/netbeans/project/RustProjectFactoryTest.java
@@ -16,15 +16,15 @@
*/
package com.github.drrb.rust.netbeans.project;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.not;
+import static org.hamcrest.Matchers.nullValue;
import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import org.openide.filesystems.FileObject;
-import static org.junit.Assert.*;
-import static org.hamcrest.Matchers.*;
-import static org.mockito.Mockito.*;
import org.netbeans.api.project.Project;
import org.netbeans.api.project.ProjectManager;
import org.netbeans.spi.project.ProjectState;
@@ -32,13 +32,10 @@
/**
*
*/
-@RunWith(MockitoJUnitRunner.class)
public class RustProjectFactoryTest {
- @Mock
- private FileObject projectFolder;
- @Mock
- private ProjectState projectState;
+ private FileObject projectFolder = mock(FileObject.class);
+ private ProjectState projectState=mock(ProjectState.class);
private RustProjectFactory factory;
@Before
@@ -65,7 +62,7 @@ public void shouldIdentifyAProjectWithACargoFile() {
public void shouldNotLoadAProjectIfItIsntARustProjectDirectory() throws Exception {
Project project = factory.loadProject(projectFolder, projectState);
- assertNull(project);
+ assertThat(project, is(nullValue()));
}
@Test
@@ -73,7 +70,7 @@ public void shouldLoadAProjectFromAProjectDirectory() throws Exception {
projectFolder = aProject();
Project project = factory.loadProject(projectFolder, projectState);
- assertNotNull(project);
+ assertThat(project, is(not(nullValue())));
}
@Test
diff --git a/src/test/java/com/github/drrb/rust/netbeans/test/Matchers.java b/src/test/java/com/github/drrb/rust/netbeans/test/Matchers.java
index fc13f29..66fbd77 100644
--- a/src/test/java/com/github/drrb/rust/netbeans/test/Matchers.java
+++ b/src/test/java/com/github/drrb/rust/netbeans/test/Matchers.java
@@ -1,18 +1,13 @@
/**
- * Copyright (C) 2017 drrb
- *
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
+ * Copyright (C) 2017 drrb This program is free software: you can redistribute
+ * it and/or modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details. You should have received a
+ * copy of the GNU General Public License along with this program. If not, see
+ * .
*/
package com.github.drrb.rust.netbeans.test;
@@ -26,7 +21,6 @@
import javax.swing.ImageIcon;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
-import org.hamcrest.StringDescription;
import org.hamcrest.TypeSafeMatcher;
import org.mockito.ArgumentMatcher;
import org.netbeans.modules.csl.api.CompletionProposal;
@@ -42,6 +36,7 @@ public class Matchers extends org.hamcrest.Matchers {
public static Matcher matchesRegex(final String regex) {
return new TypeSafeMatcher() {
+
@Override
public boolean matchesSafely(String item) {
return item.matches(regex);
@@ -78,6 +73,7 @@ public void describeTo(Description description) {
public Matcher