Added some initialisation tests

This commit is contained in:
neviyn 2021-05-07 14:00:04 +01:00
parent 96104c3899
commit bd09ba1fe0

View File

@ -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())
}
}