summaryrefslogtreecommitdiff
path: root/scalalib/test/resources
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-04-08 12:55:30 -0700
committerLi Haoyi <haoyi.sg@gmail.com>2018-04-08 12:55:30 -0700
commit62a18754179d74252668879c42e1c5d6a45fbdce (patch)
tree99a820224293a2367c116272283fd2a3426957ae /scalalib/test/resources
parentdbcad35c05f1726f26b8033524e8fdd3d68b2de9 (diff)
downloadmill-62a18754179d74252668879c42e1c5d6a45fbdce.tar.gz
mill-62a18754179d74252668879c42e1c5d6a45fbdce.tar.bz2
mill-62a18754179d74252668879c42e1c5d6a45fbdce.zip
Enable JUnit testing, via sbt-test-interface, for `JavaModule`s
Diffstat (limited to 'scalalib/test/resources')
-rw-r--r--scalalib/test/resources/hello-java/app/src/hello/Main.java10
-rw-r--r--scalalib/test/resources/hello-java/app/test/src/hello/MyAppTests.java18
-rw-r--r--scalalib/test/resources/hello-java/core/src/hello/Core.java1
-rw-r--r--scalalib/test/resources/hello-java/core/test/src/hello/MyCoreTests.java15
-rw-r--r--scalalib/test/resources/hello-java/main/src/hello/Main.java7
5 files changed, 43 insertions, 8 deletions
diff --git a/scalalib/test/resources/hello-java/app/src/hello/Main.java b/scalalib/test/resources/hello-java/app/src/hello/Main.java
new file mode 100644
index 00000000..23ddd679
--- /dev/null
+++ b/scalalib/test/resources/hello-java/app/src/hello/Main.java
@@ -0,0 +1,10 @@
+package hello;
+
+public class Main{
+ public static String getMessage(String[] args){
+ return Core.msg() + " " + args[0];
+ }
+ public static void main(String[] args){
+ System.out.println(getMessage(args));
+ }
+} \ No newline at end of file
diff --git a/scalalib/test/resources/hello-java/app/test/src/hello/MyAppTests.java b/scalalib/test/resources/hello-java/app/test/src/hello/MyAppTests.java
new file mode 100644
index 00000000..df0d0351
--- /dev/null
+++ b/scalalib/test/resources/hello-java/app/test/src/hello/MyAppTests.java
@@ -0,0 +1,18 @@
+package hello;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+
+public class MyAppTests {
+
+ @Test
+ public void coreTest() {
+ assertEquals(Core.msg(), "Hello World");
+ }
+
+ @Test
+ public void appTest() {
+ assertEquals(Main.getMessage(new String[]{"lols"}), "Hello World lols");
+ }
+
+} \ No newline at end of file
diff --git a/scalalib/test/resources/hello-java/core/src/hello/Core.java b/scalalib/test/resources/hello-java/core/src/hello/Core.java
index bef1a5a0..3ecb1f61 100644
--- a/scalalib/test/resources/hello-java/core/src/hello/Core.java
+++ b/scalalib/test/resources/hello-java/core/src/hello/Core.java
@@ -4,5 +4,4 @@ public class Core{
public static String msg(){
return "Hello World";
}
-
} \ No newline at end of file
diff --git a/scalalib/test/resources/hello-java/core/test/src/hello/MyCoreTests.java b/scalalib/test/resources/hello-java/core/test/src/hello/MyCoreTests.java
new file mode 100644
index 00000000..38bebaeb
--- /dev/null
+++ b/scalalib/test/resources/hello-java/core/test/src/hello/MyCoreTests.java
@@ -0,0 +1,15 @@
+package hello;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+
+public class MyCoreTests {
+ @Test
+ public void msgTest() {
+ assertEquals(Core.msg(), "Hello World!!");
+ }
+ @Test
+ public void lengthTest() {
+ assertEquals(Core.msg().length(), 11);
+ }
+} \ No newline at end of file
diff --git a/scalalib/test/resources/hello-java/main/src/hello/Main.java b/scalalib/test/resources/hello-java/main/src/hello/Main.java
deleted file mode 100644
index 44b927bd..00000000
--- a/scalalib/test/resources/hello-java/main/src/hello/Main.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package hello;
-
-public class Main{
- public static void main(String[] args){
- System.out.println(Core.msg() + " " + args[0]);
- }
-} \ No newline at end of file