TestContainer & Spring Test sample repo

Overview

SpringBoot Integration-Test sample 🐳

Kotlin(1.6.10) + Spring Boot 2.6.2 + Testcontainers(PostgreSQL) + MyBatis + DbUnit + Spring Security + JWT auth + Flyway
(prototype for myself)

Features

  • I wrote this for myself because there was not enough good sample code for testing SpringBoot using Testcontainers. 🐳
  • The implementation focuses on how to use TestContainer in SpringBoot tests, and the rest is not implemented tightly. (e.g. Mapper called in RestController)
  • Postgres container is reused. (Booting once)
  • As an added bonus, the user authentication uses JWT (JSON Web Token), and we created a sample Spring Security Test.
datasource.apply {
    url = container.jdbcUrl
    username = container.username
    password = container.password
    setDriverClassName(container.driverClassName)
}

There are several ways to implement this way of overwriting Properties, but I felt it was too cumbersome, so I decided to implement the datasource generation.

System.setProperty("DB_URL", container.jdbcUrl)
System.setProperty("DB_USERNAME", container.username)
System.setProperty("DB_PASSWORD", container.password)

Requirement

  • Java openjdk 17.0.1
  • Docker daemon

Author

You might also like...
A project that helps us generate the test project to test the Gradle plugin.

Ktlint Gradle Provides the function to generate a Gradle project for us to test your Gradle plugin Latest plugin version: [1.0.0] Table of content How

A sample skeleton backend app built using Spring Boot kotlin, Expedia Kotlin Graphql, Reactive Web that can be deployed to Google App Engine Flexible environmennt

spring-kotlin-gql-gae This is a sample skeleton of a backend app that was built using: Spring Boot(Kotlin) Reactive Web Sprinng Data R2DBC with MYSQL

Sample Social Login Project of Spring Boot and Kotlin

Sample-Spring-Boot-Social-Kotlin Sample Social Login Project of Spring Boot and Kotlin dependencies dependencies { implementation("org.springframewor

Spring Boot Webflux RDBMS Sample App

R2DBC Spring Boot Webflux Sample Project generate schema (DDL script) h2-console (Web based database management console) WebFlux and r2dbc is not supp

Cloud Bowl Sample - Kotlin Spring Boot

Cloud Bowl Sample - Kotlin Spring Boot To make changes, edit the src/main/kotlin/hello/KotlinApplication.kt file. Run Locally: ./mvnw spring-boot:run

Sample demonstrates use of Flow, StateFlow & how we can test Flow

FlowSample This sample demonstrates use of Flow, StateFlow & how we can test Flow. In Kotlin, Coroutine is just the scheduler part of RxJava but now w

Just a POC repo for using Kotlin continuations

This repository This is for now just a POC repo for using Kotlin continuations, but i plan on using this to make a general library for kotlin integrat

📌This repo contains the kotlin implementation of TensorflowLite Example Android Apps🚀
📌This repo contains the kotlin implementation of TensorflowLite Example Android Apps🚀

TensorflowLite Examples Kotlin This repo contains the kotlin implementation of TensorflowLite Example Apps here, which are mostly implemented in java

Repo: Programming problems with solutions in Kotlin to help avid Kotlin learners to get a strong hold on Kotlin programming.

Kotlin_practice_problems Repo: Programming problems with solutions in Kotlin to help avid Kotlin learners to get a strong hold on Kotlin programming.

Owner
Hikaru Saito
Software Engineer 🪐🪐 Spring / Kotlin / python / js / k8s ... This is my new account :D (移行中)
Hikaru Saito
In this Repo i create public apis to serve apps, like muslim apps using Spring, kotlin, and microservices

spring-freelance-apis-kotlin In this Repo i create public apis to serve apps, like muslim apps using Spring, kotlin, and microservices This repo for l

null 6 Feb 13, 2022
Copy of privat enterprice repo of project made by team 37 in course in2000 spring 2021, University of Oslo

Njord - leeway simulation app in2000-team37-njord Copy of private enterprise repo of project made by team 37 in course in2000 spring 2021, University

Petter Johan Sandvand 0 Nov 25, 2021
This repository contains RabbitMQ Protobuf starters with its usage samples for spring-rabbit and spring-cloud-starter-stream-rabbit modules

This repository contains RabbitMQ Protobuf starters with its usage samples for spring-rabbit and spring-cloud-starter-stream-rabbit modules

Maksim Kostromin 2 Nov 29, 2021
Spring-with-maven - Spring Boot App with Postgresql and maven

Spring Boot Api Aplikasi ini dibuat menggunakan bahasa kotlin dan untuk database

Aldi Aulia Rosyad 1 Jan 12, 2022
Reactive setup with Spring WebFlux , Kotlin, Postgres and Spring Data R2DBC

Reactive Spring with Kotlin and Pg Spring WebFlux with Netty instead of Spring Web with Tomcat Mono and Flux in all layers (controller, service, repo)

Bimal Raj Gyawali 7 Dec 9, 2022
Spring-kotlin - Learning API Rest with Kotlin, Spring and PostgreSQL

Kotlin, Spring, PostgreSQL and Liquibase Database Migrations Learning Kotlin for

Andre L S Ferreira 2 Feb 14, 2022
Android login spring - Android login against spring backend

Android Jetpack Compose login implementation with JWT tokens against our own bac

null 1 Feb 13, 2022
API for a library using Kotlin, Spring-boot and covered by test

Library API This API is to create Books and be able to borrow from them I'm using: Spring Boot version 2.5.6 Kotlin 1.5.31 Java 11 I'm implementing us

Daniel Queiroz 1 Nov 5, 2021
An introductory dynamics to Test Driven Development (TDD)An introductory dynamics to Test Driven Development (TDD)

tdd-demo Nesse hands-on teremos uma dinâmica introdutória a Test Driven Development (TDD), ou desenvolvimento orientado por testes. instruções 1 - Clo

Plataforma Impact 1 Jan 15, 2022
Gha-central-test - GitHub Actions Maven Central Test

GitHub Actions Maven Central Test Pushing a tag does a release. Local Maven Depl

James Ward 1 Jan 19, 2022