This repository has been archived by the owner on Sep 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented unit test & added logging
- Loading branch information
lmeinen
committed
Jun 25, 2021
1 parent
d905fac
commit 6b6c41e
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
...est/java/ch/admin/bag/covidcertificate/backend/verifier/data/AppTokenDataServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package ch.admin.bag.covidcertificate.backend.verifier.data; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import javax.sql.DataSource; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; | ||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; | ||
import org.springframework.jdbc.core.simple.SimpleJdbcInsert; | ||
|
||
class AppTokenDataServiceTest extends BaseDataServiceTest { | ||
|
||
@Autowired AppTokenDataService appTokenDataService; | ||
@Autowired DataSource dataSource; | ||
|
||
@Test | ||
void getAppTokensTest() { | ||
var appTokens = appTokenDataService.getAppTokens(); | ||
assertTrue(appTokens.isEmpty()); | ||
final var insert = new SimpleJdbcInsert(dataSource).withTableName("t_app_tokens"); | ||
final var params = new MapSqlParameterSource(); | ||
params.addValue("api_key", "4d1d5663-b4ef-46a5-85b6-3d1d376429da"); | ||
params.addValue("description", "local"); | ||
insert.execute(params); | ||
appTokens = appTokenDataService.getAppTokens(); | ||
assertEquals(1, appTokens.size()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters