File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed
src/test/kotlin/io/github/tobi/laa/spring/boot/embedded/redis Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
33val springBootVersion = " 3.2.2"
44val embeddedRedisVersion = " 1.4.1"
55val mockkVersion = " 1.13.9"
6+ val archunitVersion = " 1.2.1"
67
78plugins {
89 val springDependencyManagementVersion = " 1.1.4"
@@ -60,6 +61,7 @@ dependencies {
6061 testImplementation(" org.springframework.boot:spring-boot-starter-data-redis" )
6162 testImplementation(" org.springframework.boot:spring-boot-starter-test" )
6263 testImplementation(" io.mockk:mockk:$mockkVersion " )
64+ testImplementation(" com.tngtech.archunit:archunit-junit5:$archunitVersion " )
6365}
6466
6567tasks.withType<KotlinCompile > {
Original file line number Diff line number Diff line change 1+ package io.github.tobi.laa.spring.boot.embedded.redis
2+
3+ import com.tngtech.archunit.core.importer.ImportOption.DoNotIncludeTests
4+ import com.tngtech.archunit.junit.AnalyzeClasses
5+ import com.tngtech.archunit.junit.ArchTest
6+ import com.tngtech.archunit.lang.syntax.ArchRuleDefinition.fields
7+ import com.tngtech.archunit.library.GeneralCodingRules.*
8+
9+ /* *
10+ * Some general coding rules, in broad parts copied over from the ArchUnit examples.
11+ */
12+ @Suppress(" Unused" )
13+ @AnalyzeClasses(packagesOf = [CodingRulesTest ::class ], importOptions = [DoNotIncludeTests ::class ])
14+ internal class CodingRulesTest {
15+
16+ @ArchTest
17+ private val `No classes should access standard streams` = NO_CLASSES_SHOULD_ACCESS_STANDARD_STREAMS
18+
19+ @ArchTest
20+ private val `No classes should throw generic exceptions` = NO_CLASSES_SHOULD_THROW_GENERIC_EXCEPTIONS
21+
22+ @ArchTest
23+ private val `No classes should use Java 2 platform' s core logging facilities` =
24+ NO_CLASSES_SHOULD_USE_JAVA_UTIL_LOGGING
25+
26+ @ArchTest
27+ private val `Loggers should be private and static and final` =
28+ fields().that()
29+ .haveRawType("org.slf4j.Logger")
30+ .should().bePrivate()
31+ .andShould().beStatic()
32+ .andShould().beFinal()
33+ .`as`("Loggers should private static final.")
34+ .because("That is a convention for this project.")
35+ .allowEmptyShould(true)
36+
37+ @ArchTest
38+ private val `No classes should use Joda time` = NO_CLASSES_SHOULD_USE_JODATIME
39+
40+ @ArchTest
41+ private val `No classes should use field injection` = NO_CLASSES_SHOULD_USE_FIELD_INJECTION
42+ }
You can’t perform that action at this time.
0 commit comments