Skip to content

akutschera/spring-boot-test-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Travis CI: build status badge

How to test with Spring Boot

This is a demo repository that I use to figure out how to test a few things with Spring.

Properties

You can use many different ways to get properties into your tests.

The package ...properties shows some of them. There I have properties

  • set in the test class,
  • injected from outside with the surefire plugin
  • set in application.properties files
  • set in application-.properties files and
  • set in application.yml files

The examples should help to find out who overrides what and where you can (or need to) override default properties for testing purposes.

DataJpaTest

The package ...data.jpatest contains some database tests that use the spring @DataJpaTest annotation. I played around with some different use cases

  • The test is in the same package as the JPA-Repository and the Entity
  • The test is in different package from the JPA-Repository and the Entity

The package ...data.flyway contains some database tests that test the inclusion and exclusion of flyway db migration scripts.

About

Some example tests to show how to test with spring boot

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages