File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
dbAndCsvBatch/src/test/java/com/example/batch Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .example .batch ;
2
+
3
+ import static org .junit .jupiter .api .Assertions .*;
4
+ import static org .mockito .Mockito .*;
5
+
6
+ import org .junit .jupiter .api .Test ;
7
+ import org .springframework .boot .test .context .SpringBootTest ;
8
+ import org .springframework .test .context .TestPropertySource ;
9
+
10
+ @ SpringBootTest
11
+ @ TestPropertySource (
12
+ properties = {
13
+ "spring.batch.job.enabled=false" ,
14
+ "spring.datasource.mysqlmain.url=jdbc:mysql://localhost:3306/sampledb" ,
15
+ "spring.datasource.mysqlmain.username=sampleuser" ,
16
+ "spring.datasource.mysqlmain.password=samplepassword"
17
+ })
18
+ class DbAndCsvBatchAppTest {
19
+
20
+ @ Test
21
+ void testMainMethod () {
22
+ // Arrange
23
+ String [] args = {"--spring.batch.job.name=DB_TO_CSV" , "--spring.profiles.active=local" };
24
+ System .setProperty ("sun.java.command" , String .join (" " , args ));
25
+
26
+ // Act
27
+ DbAndCsvBatchApp .main (args );
28
+
29
+ // Assert
30
+ // Main method execution doesn't throw exceptions
31
+ }
32
+ }
You can’t perform that action at this time.
0 commit comments