@@ -180,12 +180,13 @@ Using Maven:
180
180
181
181
### Standard test
182
182
183
- Add a standard test to your project as shown below. Ideally, all checks should work and return an empty result.
183
+ Add a standard test to your project as shown below. Ideally, all checks should pass and return an empty result.
184
184
185
185
``` java
186
186
import io.github.mfvanek.pg.core.checks.common.DatabaseCheckOnHost ;
187
187
import io.github.mfvanek.pg.core.checks.common.Diagnostic ;
188
188
import io.github.mfvanek.pg.model.dbobject.DbObject ;
189
+ import org.jspecify.annotations.NonNull ;
189
190
import org.junit.jupiter.api.Test ;
190
191
import org.springframework.beans.factory.annotation.Autowired ;
191
192
import org.springframework.boot.test.context.SpringBootTest ;
@@ -200,7 +201,7 @@ import static org.assertj.core.api.Assertions.assertThat;
200
201
class DatabaseStructureStaticAnalysisTest {
201
202
202
203
@Autowired
203
- private List<DatabaseCheckOnHost<? extends DbObject > > checks;
204
+ private List<DatabaseCheckOnHost<? extends @ NonNull DbObject > > checks;
204
205
205
206
@Test
206
207
void checksShouldWork () {
@@ -217,6 +218,44 @@ class DatabaseStructureStaticAnalysisTest {
217
218
}
218
219
```
219
220
221
+ <details >
222
+ <summary >with Kotlin</summary >
223
+
224
+ ``` kotlin
225
+ import io.github.mfvanek.pg.core.checks.common.DatabaseCheckOnHost
226
+ import io.github.mfvanek.pg.core.checks.common.Diagnostic
227
+ import io.github.mfvanek.pg.model.dbobject.DbObject
228
+ import org.assertj.core.api.Assertions.assertThat
229
+ import org.junit.jupiter.api.Test
230
+ import org.springframework.beans.factory.annotation.Autowired
231
+ import org.springframework.boot.test.context.SpringBootTest
232
+ import org.springframework.test.context.ActiveProfiles
233
+
234
+ @SpringBootTest
235
+ @ActiveProfiles(" test" )
236
+ internal class DatabaseStructureStaticAnalysisTest {
237
+
238
+ @Autowired
239
+ private lateinit var checks: List <DatabaseCheckOnHost <out DbObject >>
240
+
241
+ @Test
242
+ fun checksShouldWork () {
243
+ assertThat(checks)
244
+ .hasSameSizeAs(Diagnostic .entries.toTypedArray())
245
+
246
+ checks
247
+ .filter { it.isStatic }
248
+ .forEach {
249
+ assertThat(it.check())
250
+ .`as `(it.diagnostic.name)
251
+ .isEmpty()
252
+ }
253
+ }
254
+ }
255
+ ```
256
+
257
+ </details >
258
+
220
259
### Spring Boot compatibility
221
260
222
261
| Spring Boot | Min JDK | pg-index-health-test-starter |
0 commit comments