Skip to content

lucoodevcourse/hello-java

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gradle Build

This build will always fail because it has two types of failing tests:

  • based on incorrect the behavior the main code (CUT, class-under-test), leading to failed assertions
  • based on logical errors in the test code, leading to exceptions before assertions are tested

Learning Objectives

  • Simple hello world example
  • Experience with Git source code management
  • Building with Gradle (using the Gradle wrapper)
  • Automated unit testing with JUnit
  • Continuous integration with Travis

System requirements

  • Java 11 SDK or later

Running the Application

On Linux or Mac OS X:

$ ./gradlew run

On Windows:

> gradlew run

Running the Tests

On Linux or Mac OS X:

$ ./gradlew test

On Windows:

> gradlew test

There will be a line that says > There were failing tests. See the report at: file:///... Copy & paste that line in a browser address bar, starting with file: to the end, to see the failures

Alternatively, in the Project view, right-click TestHelloWorld and select Run 'TestHelloWorld' or right-click app and select Run 'All Tests' This shows the specific JUnit assertion errors without the need for copy and paste

Running the Application Outside Gradle

UNDER CONSTRUCTION

Unlike running the application using Gradle's run task, this allows passing command-line arguments.

On Linux or Mac OS X:

$ ./gradlew startScripts
$ ./build/scripts/hello-java arg1 arg2 arg3

or

$ ./gradlew jar
$ java -jar build/lib/hello-java.jar arg1 arg2 arg3

On Windows:

> gradlew startScripts
> .\build\scripts\hello-java arg1 arg2 arg3

or

> gradlew jar
> java -jar build\lib\hello-java.jar arg1 arg2 arg3

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%