Skip to content

Commit 1b11eb8

Browse files
committed
Final, borrowed from sonar-scoverage-plugin
0 parents  commit 1b11eb8

File tree

6 files changed

+188
-0
lines changed

6 files changed

+188
-0
lines changed

.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
*.class
2+
*.log
3+
4+
# Package files
5+
*.war
6+
*.jar
7+
*.ear
8+
9+
# Maven
10+
out/
11+
target/
12+
13+
# Eclipse
14+
.project
15+
.classpath
16+
.settings/
17+
18+
# IDEA
19+
*.iml
20+
.idea
21+
22+
# OSX
23+
.DS_STORE
24+
.Trashes
25+
26+
# Windows
27+
Desktop.ini
28+
Thumbs.db
29+
30+
# Python
31+
*.pyc
32+

pom.xml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>test</groupId>
6+
<artifactId>combined-scala-java-sonar-single-module</artifactId>
7+
<packaging>jar</packaging>
8+
<version>1.0.0</version>
9+
10+
<properties>
11+
<scala.version>2.11.6</scala.version>
12+
<!--Sonar-->
13+
<sonar.core.codeCoveragePlugin>scoverage</sonar.core.codeCoveragePlugin>
14+
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
15+
<sonar.junit.reportsPath>target/surefire-reports</sonar.junit.reportsPath>
16+
<sonar.scoverage.reportPath>target/scoverage.xml</sonar.scoverage.reportPath>
17+
<sonar.scala.cobertura.reportPath>target/notthere.xml</sonar.scala.cobertura.reportPath>
18+
<sonar.sources>src</sonar.sources>
19+
<sonar.jacoco.reportPath>target/jacoco.exec</sonar.jacoco.reportPath>
20+
<sonar.exclusions>src/test/java/**,src/test/scala/**</sonar.exclusions>
21+
<sonar.sourceEncoding>UTF-8</sonar.sourceEncoding>
22+
</properties>
23+
24+
<build>
25+
<plugins>
26+
27+
<plugin>
28+
<groupId>com.google.code.sbt-compiler-maven-plugin</groupId>
29+
<artifactId>sbt-compiler-maven-plugin</artifactId>
30+
<version>1.0.0-beta5</version>
31+
<executions>
32+
<execution>
33+
<goals>
34+
<goal>compile</goal>
35+
<goal>testCompile</goal>
36+
<goal>addScalaSources</goal>
37+
</goals>
38+
<id>default-sbt-compile</id>
39+
</execution>
40+
</executions>
41+
</plugin>
42+
<plugin>
43+
<groupId>org.apache.maven.plugins</groupId>
44+
<artifactId>maven-compiler-plugin</artifactId>
45+
<version>3.2</version>
46+
<configuration>
47+
<skipMain>true</skipMain>
48+
<skip>true</skip>
49+
</configuration>
50+
</plugin>
51+
52+
<plugin>
53+
<groupId>org.jacoco</groupId>
54+
<artifactId>jacoco-maven-plugin</artifactId>
55+
<version>0.7.4.201502262128</version>
56+
<executions>
57+
<execution>
58+
<id>pre-test</id>
59+
<goals>
60+
<goal>prepare-agent</goal>
61+
</goals>
62+
</execution>
63+
</executions>
64+
</plugin>
65+
66+
<plugin>
67+
<groupId>org.scoverage</groupId>
68+
<artifactId>scoverage-maven-plugin</artifactId>
69+
<version>1.0.4</version>
70+
<configuration>
71+
<highlighting>true</highlighting>
72+
</configuration>
73+
</plugin>
74+
</plugins>
75+
</build>
76+
77+
<dependencies>
78+
<dependency>
79+
<groupId>org.scalatest</groupId>
80+
<artifactId>scalatest_2.11</artifactId>
81+
<version>2.2.1</version>
82+
<scope>test</scope>
83+
</dependency>
84+
<dependency>
85+
<groupId>org.mockito</groupId>
86+
<artifactId>mockito-all</artifactId>
87+
<version>1.9.5</version>
88+
<scope>test</scope>
89+
</dependency>
90+
<dependency>
91+
<groupId>junit</groupId>
92+
<artifactId>junit</artifactId>
93+
<version>4.11</version>
94+
</dependency>
95+
96+
<dependency>
97+
<groupId>ch.qos.logback</groupId>
98+
<artifactId>logback-classic</artifactId>
99+
<version>1.0.13</version>
100+
</dependency>
101+
102+
</dependencies>
103+
</project>

src/main/java/module1/HelloWorld.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package module1;
2+
3+
/**
4+
* Created by tim on 01/05/15.
5+
*/
6+
public class HelloWorld {
7+
8+
public String hello() {
9+
return "Hello";
10+
}
11+
12+
public void notCovered() {
13+
System.out.println("YOLO");
14+
}
15+
16+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package module1
2+
3+
class HelloScala {
4+
5+
case class TryOut(some: String, fields: List[String])
6+
7+
def test = "Hello"
8+
9+
def someOther = 42
10+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package module1;
2+
3+
import static org.junit.Assert.assertEquals;
4+
5+
public class HelloWorldTest {
6+
7+
@org.junit.Test
8+
public void testHello() throws Exception {
9+
assertEquals("Hello", new HelloWorld().hello());
10+
}
11+
}

src/test/scala/HelloScalaTest.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import org.junit.runner.RunWith
2+
import org.scalatest.junit.JUnitRunner
3+
import org.scalatest.{FlatSpec, ShouldMatchers}
4+
import module1.HelloScala
5+
6+
@RunWith(classOf[JUnitRunner])
7+
class HelloScalaTest extends FlatSpec with ShouldMatchers {
8+
9+
"it" should "work" in {
10+
val scala: HelloScala = new HelloScala()
11+
scala.test should equal("Hello")
12+
13+
scala.TryOut("String", List()) should not equal(true)
14+
}
15+
16+
}

0 commit comments

Comments
 (0)