Commits

kubek2k committed 4df9220 Merge

merge with pom refactoring + pom reformat + change in dep management + junit removed in favour of testng

Comments (0)

Files changed (11)

pom.xml

-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.kubek2k</groupId>
-  <artifactId>springockito-parent</artifactId>
-  <version>1.0.3-SNAPSHOT</version>
-  <url>https://bitbucket.org/kubek2k/springockito</url>
-  <name>Springockito parent</name>
-  <packaging>pom</packaging>
-
-  <parent>
-    <groupId>org.sonatype.oss</groupId>
-    <artifactId>oss-parent</artifactId>
-    <version>7</version>
-  </parent>
-
-  <licenses>
-    <license>
-      <name>MIT</name>
-      <url>http://www.opensource.org/licenses/mit-license.php</url>
-      <comments>Copyright (c) 2011 Jakub Janczak</comments>
-    </license>
-  </licenses>
-
-  <developers>
-    <developer>
-      <id>kubek2k</id>
-      <email>kubek2k@gmail.com</email>
-      <name>Jakub Janczak</name>
-    </developer>     
-  </developers>
-
-  <scm>
-    <url>https://bitbucket.org/kubek2k/springockito</url>
-    <connection>https://bitbucket.org/kubek2k/springockito/</connection>
-    <developerConnection>scm:hg:https://bitbucket.org/kubek2k/springockito/</developerConnection>
-  </scm>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-source-plugin</artifactId>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-javadoc-plugin</artifactId>
-      </plugin>
-    </plugins>
-    
-    <pluginManagement>
-      <plugins>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-compiler-plugin</artifactId>
-          <version>2.3.2</version>
-          <configuration>
-            <source>1.5</source>
-            <target>1.5</target>
-          </configuration>
-        </plugin>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-source-plugin</artifactId>
-          <executions>
-            <execution>
-              <phase>verify</phase>
-              <goals>
-                <goal>jar</goal>
-              </goals>
-            </execution>
-          </executions>
-        </plugin>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-javadoc-plugin</artifactId>
-          <executions>
-            <execution>
-              <id>attach-sources</id>
-              <phase>verify</phase>
-              <goals>
-                <goal>jar</goal>
-              </goals>
-            </execution>
-          </executions>
-        </plugin>
-        <plugin>
-          <artifactId>maven-release-plugin</artifactId>
-          <version>2.2</version>
-          <configuration>
-            <mavenExecutorId>forked-path</mavenExecutorId>
-            <useReleaseProfile>false</useReleaseProfile>
-            <arguments>-Psonatype-oss-release</arguments>
-          </configuration>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-</build>
-</project>

springockito-annotations/pom.xml

 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
 
-  <groupId>org.kubek2k</groupId>
-  <artifactId>springockito-annotations</artifactId>
-  <version>1.0.2-SNAPSHOT</version>
-  <name>Springockito annotations</name>
+    <groupId>org.kubek2k</groupId>
+    <artifactId>springockito-annotations</artifactId>
+    <version>1.0.2-SNAPSHOT</version>
+    <name>Springockito annotations</name>
 
-  <properties>
-    <spring.version>3.0.5.RELEASE</spring.version>
-  </properties>
+    <parent>
+        <groupId>org.kubek2k</groupId>
+        <artifactId>springockito-parent</artifactId>
+        <version>1.0.3-SNAPSHOT</version>
+    </parent>
 
-  <parent>
-    <groupId>org.kubek2k</groupId>
-    <artifactId>springockito-parent</artifactId>
-    <version>1.0.3-SNAPSHOT</version>
-  </parent>
-  
-  <scm>
-    <url>https://bitbucket.org/kubek2k/springockito</url>
-    <connection>https://bitbucket.org/kubek2k/springockito</connection>
-    <developerConnection>scm:hg:https://bitbucket.org/kubek2k/springockito</developerConnection>
-  </scm>
+    <scm>
+        <url>https://bitbucket.org/kubek2k/springockito</url>
+        <connection>https://bitbucket.org/kubek2k/springockito</connection>
+        <developerConnection>scm:hg:https://bitbucket.org/kubek2k/springockito</developerConnection>
+    </scm>
 
-  <dependencies>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-context</artifactId>
-      <version>${spring.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-test</artifactId>
-      <version>${spring.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.mockito</groupId>
-      <artifactId>mockito-all</artifactId>
-      <version>1.8.5</version>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.7</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
+    <dependencies>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-all</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-test</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
 </project>

springockito-annotations/src/test/java/org/kubek2k/springockito/annotations/SpringockitoAnnotationsComponentScanMocksIntegrationTest.java

 
 import static org.mockito.Mockito.verify;
 
-import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.annotation.DirtiesContext;
 import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
+import org.testng.annotations.Test;
 
 @ContextConfiguration(loader = SpringockitoContextLoader.class, locations = "classpath:/componentScanMockContext.xml")
-public class SpringockitoAnnotationsComponentScanMocksIntegrationTest extends AbstractJUnit4SpringContextTests {
+public class SpringockitoAnnotationsComponentScanMocksIntegrationTest extends AbstractTestNGSpringContextTests {
 
     @ReplaceWithMock
     @Autowired

springockito-annotations/src/test/java/org/kubek2k/springockito/annotations/SpringockitoAnnotationsComponentScanSpiesIntegrationTest.java

 package org.kubek2k.springockito.annotations;
 
-import org.junit.Assert;
-import org.junit.Test;
+import static org.mockito.Mockito.verify;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.annotation.DirtiesContext;
 import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
-
-import static org.mockito.Mockito.verify;
+import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
+import org.testng.Assert;
+import org.testng.annotations.Test;
 
 @ContextConfiguration(loader = SpringockitoContextLoader.class,
 locations = "classpath:/componentScanMockContext.xml")
-public class SpringockitoAnnotationsComponentScanSpiesIntegrationTest extends AbstractJUnit4SpringContextTests {
+public class SpringockitoAnnotationsComponentScanSpiesIntegrationTest extends AbstractTestNGSpringContextTests {
     
     @WrapWithSpy
     @Autowired

springockito-annotations/src/test/java/org/kubek2k/springockito/annotations/SpringockitoAnnotationsMocksIntegrationTest.java

 
 import static org.mockito.Mockito.verify;
 
-import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.annotation.DirtiesContext;
 import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
+import org.testng.annotations.Test;
 
 @ContextConfiguration(loader = SpringockitoContextLoader.class,
 locations = "classpath:/mockContext.xml")
-public class SpringockitoAnnotationsMocksIntegrationTest extends AbstractJUnit4SpringContextTests {
+public class SpringockitoAnnotationsMocksIntegrationTest extends AbstractTestNGSpringContextTests {
     
     @ReplaceWithMock
     @Autowired

springockito-annotations/src/test/java/org/kubek2k/springockito/annotations/SpringockitoAnnotationsSpiesIntegrationTest.java

 
 import static org.mockito.Mockito.verify;
 
-import org.junit.Assert;
-import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.annotation.DirtiesContext;
 import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
+import org.testng.Assert;
+import org.testng.annotations.Test;
 
 @ContextConfiguration(loader = SpringockitoContextLoader.class,
 locations = "classpath:/mockContext.xml")
-public class SpringockitoAnnotationsSpiesIntegrationTest extends AbstractJUnit4SpringContextTests {
+public class SpringockitoAnnotationsSpiesIntegrationTest extends AbstractTestNGSpringContextTests {
 
     @WrapWithSpy
     @Autowired
         int result = outerBean.doSomething();
         
         // the actual returned value is real and we can verify interaction
-        Assert.assertEquals(InnerBean.VALUE_RETURNED_BY_INNER, result);
+        Assert.assertEquals(result, InnerBean.VALUE_RETURNED_BY_INNER);
         verify(innerBean).doSomething();
     }
     

springockito-annotations/src/test/java/org/kubek2k/springockito/annotations/SpringockitoContextLoaderTest.java

 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyNoMoreInteractions;
 
-import org.junit.Test;
-import org.mockito.Spy;
 import org.springframework.context.ApplicationContext;
+import org.testng.annotations.Test;
 
 public class SpringockitoContextLoaderTest {
     @Test
     }
 
     public static class SomeTestClass {
+        @SuppressWarnings("unused")
         @ReplaceWithMock
         private OuterBean outerBean1;
         
+        @SuppressWarnings("unused")
         @WrapWithSpy
         private OuterBean outerBean;
     }

springockito-parent/pom.xml

+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.kubek2k</groupId>
+  <artifactId>springockito-parent</artifactId>
+  <version>1.0.3-SNAPSHOT</version>
+  <url>https://bitbucket.org/kubek2k/springockito</url>
+  <name>Springockito parent</name>
+  <packaging>pom</packaging>
+
+  <parent>
+    <groupId>org.sonatype.oss</groupId>
+    <artifactId>oss-parent</artifactId>
+    <version>7</version>
+  </parent>
+
+  <licenses>
+    <license>
+      <name>MIT</name>
+      <url>http://www.opensource.org/licenses/mit-license.php</url>
+      <comments>Copyright (c) 2011 Jakub Janczak</comments>
+    </license>
+  </licenses>
+
+  <developers>
+    <developer>
+      <id>kubek2k</id>
+      <email>kubek2k@gmail.com</email>
+      <name>Jakub Janczak</name>
+    </developer>
+  </developers>
+
+  <scm>
+    <url>https://bitbucket.org/kubek2k/springockito</url>
+    <connection>https://bitbucket.org/kubek2k/springockito/</connection>
+    <developerConnection>scm:hg:https://bitbucket.org/kubek2k/springockito/</developerConnection>
+  </scm>
+
+    <properties>
+      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+      <spring.version>3.0.5.RELEASE</spring.version>
+    </properties>
+
+  <dependencyManagement>
+    <dependencies>
+
+      <dependency>
+        <groupId>org.mockito</groupId>
+        <artifactId>mockito-all</artifactId>
+        <version>1.9.0</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>spring-core</artifactId>
+        <version>${spring.version}</version>
+        <scope>provided</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>spring-expression</artifactId>
+        <version>${spring.version}</version>
+        <scope>provided</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>spring-beans</artifactId>
+        <version>${spring.version}</version>
+        <scope>provided</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>spring-context</artifactId>
+        <version>${spring.version}</version>
+        <scope>provided</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>spring-test</artifactId>
+        <version>${spring.version}</version>
+        <scope>provided</scope>
+      </dependency>
+
+      <dependency>
+        <groupId>org.testng</groupId>
+        <artifactId>testng</artifactId>
+        <version>6.3.1</version>
+        <scope>test</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-source-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+      </plugin>
+    </plugins>
+
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <version>2.3.2</version>
+          <configuration>
+            <source>1.5</source>
+            <target>1.5</target>
+          </configuration>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-source-plugin</artifactId>
+          <version>2.1.2</version>
+          <executions>
+            <execution>
+              <phase>verify</phase>
+              <goals>
+                <goal>jar</goal>
+              </goals>
+            </execution>
+          </executions>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-javadoc-plugin</artifactId>
+          <version>2.8</version>
+          <executions>
+            <execution>
+              <id>attach-sources</id>
+              <phase>verify</phase>
+              <goals>
+                <goal>jar</goal>
+              </goals>
+            </execution>
+          </executions>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-release-plugin</artifactId>
+          <version>2.2.2</version>
+          <configuration>
+            <mavenExecutorId>forked-path</mavenExecutorId>
+            <useReleaseProfile>false</useReleaseProfile>
+            <arguments>-Psonatype-oss-release</arguments>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>

springockito/pom.xml

-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.kubek2k</groupId>
-  <artifactId>springockito</artifactId>
-  <version>1.0.4-SNAPSHOT</version>
-  <url>https://bitbucket.org/kubek2k/springockito</url>
-  <description>Simple tool to create mocks in Spring environment</description>
-  <name>Springockito</name>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.kubek2k</groupId>
+    <artifactId>springockito</artifactId>
+    <version>1.0.4-SNAPSHOT</version>
+    <url>https://bitbucket.org/kubek2k/springockito</url>
+    <description>Simple tool to create mocks in Spring environment</description>
+    <name>Springockito</name>
 
-  <properties>
-    <spring.version>3.0.5.RELEASE</spring.version>
-  </properties>
+    <parent>
+        <groupId>org.kubek2k</groupId>
+        <artifactId>springockito-parent</artifactId>
+        <version>1.0.3-SNAPSHOT</version>
+    </parent>
 
-  <parent>
-    <groupId>org.kubek2k</groupId>
-    <artifactId>springockito-parent</artifactId>
-    <version>1.0.3-SNAPSHOT</version>
-  </parent>
+    <scm>
+        <url>https://bitbucket.org/kubek2k/springockito</url>
+        <connection>https://bitbucket.org/kubek2k/springockito</connection>
+        <developerConnection>scm:hg:https://bitbucket.org/kubek2k/springockito</developerConnection>
+    </scm>
 
-  <scm>
-    <url>https://bitbucket.org/kubek2k/springockito</url>
-    <connection>https://bitbucket.org/kubek2k/springockito</connection>
-    <developerConnection>scm:hg:https://bitbucket.org/kubek2k/springockito</developerConnection>
-  </scm>
+    <dependencies>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-all</artifactId>
+            <scope>provided</scope>
+        </dependency>
 
-  <dependencies>
-    <dependency>
-      <groupId>org.mockito</groupId>
-      <artifactId>mockito-all</artifactId>
-      <version>1.8.5</version>
-    </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-expression</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-beans</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+        </dependency>
 
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-core</artifactId>
-      <version>${spring.version}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-expression</artifactId>
-      <version>${spring.version}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-beans</artifactId>
-      <version>${spring.version}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-context</artifactId>
-      <version>${spring.version}</version>
-      <scope>provided</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-test</artifactId>
-      <version>${spring.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.testng</groupId>
-      <artifactId>testng</artifactId>
-      <version>5.14.2</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
 </project>

springockito/src/test/java/org/kubek2k/mockito/spring/MockitoMockHandlerComponentScanIntegrationTest.java

 package org.kubek2k.mockito.spring;
 
+import static org.testng.Assert.assertNotNull;
+
 import org.kubek2k.mockito.spring.testbeans.BeanAutowiringMock;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
 import org.testng.annotations.Test;
 
-import static org.testng.Assert.assertNotNull;
-
-//Test case for issue 3: https://bitbucket.org/kubek2k/springockito/issue/3/problem-with-injecting-mockito-mock-by
 @ContextConfiguration(locations={"classpath:spring/mockitoComponentScanContext.xml"})
 public class MockitoMockHandlerComponentScanIntegrationTest extends AbstractTestNGSpringContextTests {
 

springockito/src/test/java/org/kubek2k/mockito/spring/MockitoMockHandlerIntegrationTest.java

 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
 
-import java.util.Date;
-
 import org.mockito.cglib.proxy.Factory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;