File tree Expand file tree Collapse file tree
main/java/dev/project516/JavaAppTemplate
test/java/dev/project516/JavaAppTemplate Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2727
2828application {
2929 // Define the main class for the application.
30- mainClass = ' org.example.App '
30+ mainClass = ' dev.project516.JavaAppTemplate.Main '
3131}
3232
3333compileJava. dependsOn spotlessApply
@@ -44,7 +44,11 @@ spotless {
4444jar {
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}
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 11#! /bin/sh
22
3- ./gradlew build
3+ ./gradlew build || exit 1
44
55java -jar app/build/libs/app-all.jar
You can’t perform that action at this time.
0 commit comments