77import static de .jaggl .sqlbuilder .utils .Indentation .enabled ;
88import static org .assertj .core .api .Assertions .assertThat ;
99
10+ import java .time .LocalDate ;
11+ import java .time .LocalDateTime ;
12+
1013import org .junit .jupiter .api .Test ;
1114
1215import de .jaggl .sqlbuilder .columns .datetime .DateColumn ;
16+ import de .jaggl .sqlbuilder .columns .datetime .DateTimeColumn ;
1317import de .jaggl .sqlbuilder .columns .number .doubletype .DoubleColumn ;
1418import de .jaggl .sqlbuilder .columns .number .integer .BigIntColumn ;
1519import de .jaggl .sqlbuilder .columns .number .integer .IntColumn ;
@@ -28,6 +32,8 @@ class InsertTest
2832 public static final DoubleColumn SIZE = PERSONS .doubleColumn ("size" ).build ();
2933 public static final IntColumn COUNT = PERSONS .intColumn ("count" ).build ();
3034 public static final DateColumn BIRTHDAY = PERSONS .dateColumn ("birthday" ).build ();
35+ public static final DateColumn DEATHDAY = PERSONS .dateColumn ("deathday" ).build ();
36+ public static final DateTimeColumn LAST_UPDATE = PERSONS .dateTimeColumn ("lastUpdate" ).build ();
3137 public static final BigIntColumn NUMBERS = PERSONS .bigIntColumn ("numbers" ).build ();
3238
3339 @ Test
@@ -37,6 +43,8 @@ void testBuildInsert()
3743 .set (NICKNAME , FORENAME )
3844 .set (FORENAME , "Martin" )
3945 .set (BIRTHDAY , now ())
46+ .set (DEATHDAY , LocalDate .of (2020 , 4 , 24 ))
47+ .set (LAST_UPDATE , LocalDateTime .of (2020 , 4 , 24 , 13 , 53 ))
4048 .set (COUNT , Integer .valueOf (5 ))
4149 .set (AGE , 38 )
4250 .set (SIZE , 175.89 )
@@ -47,7 +55,7 @@ void testBuildInsert()
4755 insert .println (SYBASE , enabled ());
4856
4957 assertThat (insert .build ())
50- .isEqualTo ("INSERT INTO `persons` SET `persons`.`nickname` = `persons`.`forename`, `persons`.`forename` = 'Martin', `persons`.`birthday` = NOW(), `persons`.`count` = 5, `persons`.`age` = 38, `persons`.`size` = 175.89, `persons`.`numbers` = :numbers, `persons`.`lastname` = 'Schumacher'" );
58+ .isEqualTo ("INSERT INTO `persons` SET `persons`.`nickname` = `persons`.`forename`, `persons`.`forename` = 'Martin', `persons`.`birthday` = NOW(), `persons`.`deathday` = '2020-04-24', `persons`.`lastUpdate` = '2020-04-24 13:53:00.000000', `persons`.` count` = 5, `persons`.`age` = 38, `persons`.`size` = 175.89, `persons`.`numbers` = :numbers, `persons`.`lastname` = 'Schumacher'" );
5159
5260 assertThat (insert .build (enabled ()))
5361 .isEqualTo ("INSERT INTO\n " //
@@ -56,6 +64,8 @@ void testBuildInsert()
5664 + " `persons`.`nickname` = `persons`.`forename`,\n " //
5765 + " `persons`.`forename` = 'Martin',\n " //
5866 + " `persons`.`birthday` = NOW(),\n " //
67+ + " `persons`.`deathday` = '2020-04-24',\n " //
68+ + " `persons`.`lastUpdate` = '2020-04-24 13:53:00.000000',\n " //
5969 + " `persons`.`count` = 5,\n " //
6070 + " `persons`.`age` = 38,\n " //
6171 + " `persons`.`size` = 175.89,\n " //
0 commit comments