Skip to content

AmirNaghibi/JavaStarterApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Starter Application

This is a sample Java application that demonstrates the use of various development tools and libraries:

  • Gradle as build tool
  • Checkstyle for code formatting
  • SpotBugs for static code analysis
  • JUnit 5 for testing
  • Mockito for mocking
  • AssertJ for fluent assertions
  • JaCoCo for code coverage
  • Lombok for reducing boilerplate code

Prerequisites

  • Java 17 or higher
  • Gradle (wrapper is included)

Building the Project

To build the project, run:

./gradlew build

This will:

  1. Compile the code
  2. Run the tests
  3. Generate test coverage reports
  4. Run Checkstyle
  5. Run SpotBugs

Running Tests

To run tests:

./gradlew test

Code Coverage

To generate code coverage reports:

./gradlew jacocoTestReport

The reports will be available in:

  • HTML: build/reports/jacoco/test/html/index.html
  • XML: build/reports/jacoco/test/jacocoTestReport.xml

Code Quality

Checkstyle

To run Checkstyle:

./gradlew checkstyleMain checkstyleTest
# run the following for both main and test source set
./gradlew checkstyleAll

The report will be available in build/reports/checkstyle/

SpotBugs

To run SpotBugs:

./gradlew spotbugsMain spotbugsTest
# run the following for both main and test source set
./gradlew spotbugsAll

The report will be available in build/reports/spotbugs/

Project Structure

  • src/main/java/ - Source files
  • src/test/java/ - Test files
  • config/checkstyle/ - Checkstyle configuration
  • build.gradle - Gradle build configuration

Sample Code

The project includes a simple Calculator class that demonstrates:

  • Lombok annotations (@Data, @NoArgsConstructor, @AllArgsConstructor)
  • SpotBugs annotations
  • Unit tests with JUnit 5
  • Mockito spy
  • AssertJ assertions

About

Java app configured with Gradle,Junit,Mockito,AsserJ,Jacoco,Checkstyle,Spotbugs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages