You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2018/06/23 14:25:41 UTC

[GitHub] blackleg closed pull request #449: [WIP] Added mockito library.

blackleg closed pull request #449: [WIP] Added mockito library.
URL: https://github.com/apache/incubator-netbeans/pull/449
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/libs.mockito/build.xml b/libs.mockito/build.xml
new file mode 100644
index 000000000..7f7dbd456
--- /dev/null
+++ b/libs.mockito/build.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<project name="libs.mockito" default="build" basedir=".">
+    <property name="license.file" location="../nbbuild/licenses/MIT"/>
+    <target name="-create-license.file"/>
+    <import file="../nbbuild/templates/projectized.xml"/>
+</project>
diff --git a/libs.mockito/external/binaries-list b/libs.mockito/external/binaries-list
new file mode 100644
index 000000000..37f24ed6a
--- /dev/null
+++ b/libs.mockito/external/binaries-list
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+B84BFBBC29CD22C9529409627AF6EA2897F4FA85 org.mockito:mockito-core:2.15.0
+51218A01A882C04D0ABA8C028179CCE488BBCB58 net.bytebuddy:byte-buddy:1.7.9
+A6C65F9DA7F467EE1F02FF2841FFD3155AEE2FC9 net.bytebuddy:byte-buddy-agent:1.7.9
+639033469776FD37C08358C6B92A4761FEB2AF4B org.objenesis:objenesis:2.6
diff --git a/libs.mockito/external/mockito-core-2.15.0-license.txt b/libs.mockito/external/mockito-core-2.15.0-license.txt
new file mode 100644
index 000000000..d91c030ed
--- /dev/null
+++ b/libs.mockito/external/mockito-core-2.15.0-license.txt
@@ -0,0 +1,28 @@
+Name: Mockito
+Version: 1.15.0
+License: MIT
+Description: Most popular mocking framework for Java.
+Origin: Mockito
+URL: http://search.maven.org/#artifactdetails%7Corg.mockito%7Cmockito-core%7C2.15.0%7Cjar
+
+The MIT License
+
+Copyright (c) 2007 Mockito contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/libs.mockito/manifest.mf b/libs.mockito/manifest.mf
new file mode 100644
index 000000000..a2dd4cf34
--- /dev/null
+++ b/libs.mockito/manifest.mf
@@ -0,0 +1,4 @@
+Manifest-Version: 1.0
+OpenIDE-Module: org.netbeans.libs.mockito
+OpenIDE-Module-Specification-Version: 1.18
+OpenIDE-Module-Localizing-Bundle: org/netbeans/libs/mockito/Bundle.properties
diff --git a/libs.mockito/nbproject/project.properties b/libs.mockito/nbproject/project.properties
new file mode 100644
index 000000000..c6316cbcc
--- /dev/null
+++ b/libs.mockito/nbproject/project.properties
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+is.autoload=true
+nbm.target.cluster=platform
+release.external/mockito-core-2.15.0.jar=modules/ext/mockito-core-2.15.0.jar
+release.external/byte-buddy-1.7.9.jar=modules/ext/byte-buddy-1.7.9.jar
+release.external/byte-buddy-agent-1.7.9.jar=modules/ext/byte-buddy-agent-1.7.9.jar
+release.external/objenesis-2.6.jar=modules/ext/objenesis-2.6.jar
+sigtest.skip.check=true
+sigtest.fail.on.error=false
diff --git a/libs.mockito/nbproject/project.xml b/libs.mockito/nbproject/project.xml
new file mode 100644
index 000000000..993976455
--- /dev/null
+++ b/libs.mockito/nbproject/project.xml
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.apisupport.project</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
+            <code-name-base>org.netbeans.libs.mockito</code-name-base>
+            <module-dependencies/>
+            <public-packages>
+                <package>org.mockito</package>
+                <package>org.mockito.configuration</package>
+                <package>org.mockito.exceptions.base</package>
+                <package>org.mockito.exceptions.misusing</package>
+                <package>org.mockito.exceptions.stacktrace</package>
+                <package>org.mockito.exceptions.verification</package>
+                <package>org.mockito.exceptions.verification.junit</package>
+                <package>org.mockito.hamcrest</package>
+                <package>org.mockito.internal</package>
+                <package>org.mockito.internal.configuration</package>
+                <package>org.mockito.internal.configuration.injection</package>
+                <package>org.mockito.internal.configuration.injection.filter</package>
+                <package>org.mockito.internal.configuration.injection.scanner</package>
+                <package>org.mockito.internal.configuration.plugins</package>
+                <package>org.mockito.internal.creation</package>
+                <package>org.mockito.internal.creation.bytebuddy</package>
+                <package>org.mockito.internal.creation.instance</package>
+                <package>org.mockito.internal.creation.settings</package>
+                <package>org.mockito.internal.creation.util</package>
+                <package>org.mockito.internal.debugging</package>
+                <package>org.mockito.internal.exceptions</package>
+                <package>org.mockito.internal.exceptions.stacktrace</package>
+                <package>org.mockito.internal.exceptions.util</package>
+                <package>org.mockito.internal.framework</package>
+                <package>org.mockito.internal.hamcrest</package>
+                <package>org.mockito.internal.handler</package>
+                <package>org.mockito.internal.invocation</package>
+                <package>org.mockito.internal.invocation.finder</package>
+                <package>org.mockito.internal.junit</package>
+                <package>org.mockito.internal.junit.util</package>
+                <package>org.mockito.internal.listeners</package>
+                <package>org.mockito.internal.matchers</package>
+                <package>org.mockito.internal.matchers.apachecommons</package>
+                <package>org.mockito.internal.matchers.text</package>
+                <package>org.mockito.internal.progress</package>
+                <package>org.mockito.internal.reporting</package>
+                <package>org.mockito.internal.runners</package>
+                <package>org.mockito.internal.runners.util</package>
+                <package>org.mockito.internal.session</package>
+                <package>org.mockito.internal.stubbing</package>
+                <package>org.mockito.internal.stubbing.answers</package>
+                <package>org.mockito.internal.stubbing.defaultanswers</package>
+                <package>org.mockito.internal.util</package>
+                <package>org.mockito.internal.util.collections</package>
+                <package>org.mockito.internal.util.concurrent</package>
+                <package>org.mockito.internal.util.io</package>
+                <package>org.mockito.internal.util.reflection</package>
+                <package>org.mockito.internal.verification</package>
+                <package>org.mockito.internal.verification.api</package>
+                <package>org.mockito.internal.verification.argumentmatching</package>
+                <package>org.mockito.internal.verification.checkers</package>
+                <package>org.mockito.invocation</package>
+                <package>org.mockito.junit</package>
+                <package>org.mockito.listeners</package>
+                <package>org.mockito.mock</package>
+                <package>org.mockito.plugins</package>
+                <package>org.mockito.quality</package>
+                <package>org.mockito.runners</package>
+                <package>org.mockito.session</package>
+                <package>org.mockito.stubbing</package>
+                <package>org.mockito.verification</package>
+            </public-packages>
+            <class-path-extension>
+                <runtime-relative-path>ext/mockito-core-2.15.0.jar</runtime-relative-path>
+                <binary-origin>external/mockito-core-2.15.0.jar</binary-origin>
+            </class-path-extension>
+            <class-path-extension>
+                <runtime-relative-path>ext/objenesis-2.6.jar</runtime-relative-path>
+                <binary-origin>external/objenesis-2.6.jar</binary-origin>
+            </class-path-extension>
+            <class-path-extension>
+                <runtime-relative-path>ext/byte-buddy-agent-1.7.9.jar</runtime-relative-path>
+                <binary-origin>external/byte-buddy-agent-1.7.9.jar</binary-origin>
+            </class-path-extension>
+            <class-path-extension>
+                <runtime-relative-path>ext/byte-buddy-1.7.9.jar</runtime-relative-path>
+                <binary-origin>external/byte-buddy-1.7.9.jar</binary-origin>
+            </class-path-extension>
+        </data>
+    </configuration>
+</project>
diff --git a/libs.mockito/src/org/netbeans/libs/mockito/Bundle.properties b/libs.mockito/src/org/netbeans/libs/mockito/Bundle.properties
new file mode 100644
index 000000000..695154b1e
--- /dev/null
+++ b/libs.mockito/src/org/netbeans/libs/mockito/Bundle.properties
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+OpenIDE-Module-Name=Mockito
+OpenIDE-Module-Display-Category=Libraries
+OpenIDE-Module-Short-Description=Bundles the Mockito mock library.
+OpenIDE-Module-Long-Description=\
+    Most popular mocking framework for Java.
diff --git a/nbbuild/cluster.properties b/nbbuild/cluster.properties
index 6fe1b2529..206cbca1c 100644
--- a/nbbuild/cluster.properties
+++ b/nbbuild/cluster.properties
@@ -220,6 +220,7 @@ nb.cluster.platform=\
         libs.jna.platform,\
         libs.jsr223,\
         libs.junit4,\
+        libs.mockito,\
         libs.osgi,\
         libs.testng,\
         masterfs,\
diff --git a/nbjunit/nbproject/project.xml b/nbjunit/nbproject/project.xml
index 5e9bedfd3..931508758 100644
--- a/nbjunit/nbproject/project.xml
+++ b/nbjunit/nbproject/project.xml
@@ -55,9 +55,12 @@
                         <compile-dependency/>
                     </test-dependency>
                     <test-dependency>
-                        <code-name-base>org.openide.util.ui</code-name-base>
+                        <code-name-base>org.netbeans.libs.mockito</code-name-base>
+                        <compile-dependency/>
+                    </test-dependency>
+                    <test-dependency>
+                        <code-name-base>org.openide.actions</code-name-base>
                         <compile-dependency/>
-                        <test/>
                     </test-dependency>
                     <test-dependency>
                         <code-name-base>org.openide.util</code-name-base>
@@ -67,6 +70,11 @@
                         <code-name-base>org.openide.util.lookup</code-name-base>
                         <compile-dependency/>
                     </test-dependency>
+                    <test-dependency>
+                        <code-name-base>org.openide.util.ui</code-name-base>
+                        <compile-dependency/>
+                        <test/>
+                    </test-dependency>
                 </test-type>
             </test-dependencies>
             <public-packages>
diff --git a/nbjunit/test/unit/src/org/netbeans/junit/NbTestCaseMockitoTest.java b/nbjunit/test/unit/src/org/netbeans/junit/NbTestCaseMockitoTest.java
new file mode 100644
index 000000000..1c7a68c3d
--- /dev/null
+++ b/nbjunit/test/unit/src/org/netbeans/junit/NbTestCaseMockitoTest.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.junit;
+
+import org.mockito.Mockito;
+import static org.mockito.Mockito.mock;
+
+/**
+ *
+ * @author Hector Espert
+ */
+public class NbTestCaseMockitoTest extends NbTestCase {
+    
+    public NbTestCaseMockitoTest(String name) {
+        super(name);
+    }
+    
+    
+    public void testMockInterface() throws Exception {
+        NbTest mock = mock(NbTest.class);
+        assertNotNull(mock);
+        
+        Mockito.when(mock.toString()).thenReturn("RETURN");
+        assertEquals("RETURN", mock.toString());
+    }
+    
+    public void testMockClass() throws Exception {
+        NbTest mockInstance = mock(NbTestCase.class);
+        assertNotNull(mockInstance);
+        
+        Mockito.when(mockInstance.toString()).thenReturn("RETURN");
+        assertEquals("RETURN", mockInstance.toString());
+    }
+    
+}


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists