Skip to content

Maven pom.xml contains all necessary dependencies for the Spock framework and a project structure.

Notifications You must be signed in to change notification settings

hameister/SpockSpringBootTemplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SpockSpringBootTemplate

The template serves as a copy template for Spring Boot applications, which should use the Spock framework for testing. The pom.xml file contains all the necessary dependencies, and for a very simple Spring Boot application, there are both JUnit tests and Spock tests.

In addition, the directory structure for the Spock tests and the JUnit tests is created.

The Example application

The WeightReader class reads a text file containing a WeightData record per line, which includes a weight (80.7) and a date (28.10.). The WeightDataImporter class uses the WeightReader to write the scanned text file to a database via a repository (WeightDataRepository). The example uses an H2 database. The WeightService class provides a function that calculates the average weight and one that returns the number of records. These features are tested with Spock and JUnit.

Build and run tests with

mvn clean install

Disclaimer

My projects, which I publish on Github, are prototypes that reflect my knowledge at the time I checked in the code and are primarily meant to allow me to copy or paste code snippets. If I want to solve a similar problem in the future. Often there is also a blogpost on my website www.hameister.org about the code snippets, which describes the source code in more detail. The code was never meant for strangers to blindly copy and use it in their projects in production. If the snippets help someone, I'm glad, but I do not guarantee the correctness. In addition, I only take care of the projects when I have my own needs. If someone has suggested corrections, they are welcome to submit a pull request. For tips and suggestions for improvement, of course, I am very grateful. There is always someone who knows more about a technology or framework.

About

Maven pom.xml contains all necessary dependencies for the Spock framework and a project structure.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published