Skip to content

Commit 1ba9d68

Browse files
authored
Merge pull request #9 from Project516/dev
update template and fix few bugs
2 parents 80dbe3c + 583170c commit 1ba9d68

File tree

4 files changed

+33
-3
lines changed

4 files changed

+33
-3
lines changed

app/build.gradle

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ java {
2727

2828
application {
2929
// Define the main class for the application.
30-
mainClass = 'org.example.App'
30+
mainClass = 'dev.project516.JavaAppTemplate.Main'
3131
}
3232

3333
compileJava.dependsOn spotlessApply
@@ -44,7 +44,11 @@ spotless {
4444
jar {
4545
manifest {
4646
attributes(
47-
'Main-Class': 'org.example.App'
47+
'Main-Class': 'dev.project516.JavaAppTemplate.Main'
4848
)
4949
}
50+
}
51+
52+
run {
53+
standardInput = System.in
5054
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package dev.project516.JavaAppTemplate;
2+
3+
public class Main {
4+
5+
public String greetUser() {
6+
return "Hello!";
7+
}
8+
9+
public static void main(String[] args) {
10+
11+
System.out.println(new Main().greetUser());
12+
}
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package dev.project516.JavaAppTemplate;
2+
3+
import static org.junit.Assert.*;
4+
5+
import org.junit.Test;
6+
7+
public class MainTest {
8+
@Test
9+
public void testGreetsUser() {
10+
Main classUnderTest = new Main();
11+
assertNotNull("Should greet the user", classUnderTest.greetUser());
12+
}
13+
}

test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/sh
22

3-
./gradlew build
3+
./gradlew build || exit 1
44

55
java -jar app/build/libs/app-all.jar

0 commit comments

Comments
 (0)