Skip to content

Commit 876798d

Browse files
committed
test: configure H2 database for tests
1 parent c1ef7db commit 876798d

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ dependencies {
3232
testImplementation("org.springframework.boot:spring-boot-starter-data-jpa-test")
3333
testImplementation("org.springframework.boot:spring-boot-starter-flyway-test")
3434
testImplementation("org.springframework.boot:spring-boot-starter-webmvc-test")
35+
testImplementation("com.h2database:h2")
3536
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
3637
}
3738

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
package com.github.imdmk.nbpcurrencyconverter;
22

3-
import org.junit.jupiter.api.Test;
43
import org.springframework.boot.test.context.SpringBootTest;
4+
import org.springframework.test.context.ActiveProfiles;
55

66
@SpringBootTest
7+
@ActiveProfiles("test")
78
class NbpCurrencyConverterApplicationTests {
8-
9-
@Test
10-
void contextLoads() {
11-
}
12-
139
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
spring.datasource.url=jdbc:h2:mem:testdb
2+
spring.datasource.driver-class-name=org.h2.Driver
3+
spring.datasource.username=sa
4+
spring.datasource.password=
5+
6+
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
7+
8+
spring.flyway.enabled=false

0 commit comments

Comments
 (0)