From bd09ba1fe05200971edc54447d0ca981feace529 Mon Sep 17 00:00:00 2001 From: neviyn Date: Fri, 7 May 2021 14:00:04 +0100 Subject: [PATCH] Added some initialisation tests --- .../co/neviyn/booru/BooruApplicationTests.kt | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/test/kotlin/uk/co/neviyn/booru/BooruApplicationTests.kt b/src/test/kotlin/uk/co/neviyn/booru/BooruApplicationTests.kt index 4ca5d0f..c8c47c5 100644 --- a/src/test/kotlin/uk/co/neviyn/booru/BooruApplicationTests.kt +++ b/src/test/kotlin/uk/co/neviyn/booru/BooruApplicationTests.kt @@ -1,6 +1,9 @@ package uk.co.neviyn.booru +import org.junit.jupiter.api.Assertions.assertNotNull +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test +import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest @SpringBootTest @@ -10,4 +13,39 @@ class BooruApplicationTests { fun contextLoads() { } + @Test + fun repositoriesLoad( + @Autowired memberRepository: MemberRepository?, + @Autowired imageRepository: ImageRepository?, + @Autowired tagRepository: TagRepository?, + @Autowired roleRepository: RoleRepository? + ) { + assertNotNull(memberRepository) + assertNotNull(imageRepository) + assertNotNull(tagRepository) + assertNotNull(roleRepository) + } + + @Test + fun servicesLoad( + @Autowired fileSystemStorageService: FileSystemStorageService?, + @Autowired customUserDetailsService: CustomUserDetailsService? + ) { + assertNotNull(fileSystemStorageService) + assertNotNull(customUserDetailsService) + } + + @Test + fun configurationPropertiesLoad( + @Autowired imageConfigurationProperties: ImageConfigurationProperties? + ) { + assertNotNull(imageConfigurationProperties) + assertNotNull(imageConfigurationProperties!!.directory) + assertNotNull(imageConfigurationProperties.types) + assertTrue(imageConfigurationProperties.types.isNotEmpty()) + assertTrue(imageConfigurationProperties.directory.exists()) + assertTrue(imageConfigurationProperties.directory.canRead()) + assertTrue(imageConfigurationProperties.directory.canWrite()) + } + }