2626import org .junit .jupiter .api .Test ;
2727import org .springframework .data .annotation .Id ;
2828import org .springframework .data .relational .core .sql .SqlIdentifier ;
29+ import org .springframework .data .relational .core .sql .Table ;
2930
3031/**
3132 * Unit tests for the construction of {@link org.springframework.data.relational.core.mapping.AggregatePath.ColumnInfos}
32- *
33+ *
3334 * @author Jens Schauder
3435 */
3536class ColumnInfosUnitTests {
3637
38+ static final Table TABLE = Table .create ("dummy" );
3739 static final SqlIdentifier ID = SqlIdentifier .quoted ("ID" );
3840 RelationalMappingContext context = new RelationalMappingContext ();
3941
40- @ Test // GH-574
42+ @ Test
43+ // GH-574
4144 void emptyColumnInfos () {
4245
4346 AggregatePath .ColumnInfos columnInfos = AggregatePath .ColumnInfos .empty (basePath (DummyEntity .class ));
4447
4548 assertThat (columnInfos .isEmpty ()).isTrue ();
4649 assertThrows (NoSuchElementException .class , columnInfos ::any );
4750 assertThrows (IllegalStateException .class , columnInfos ::unique );
48- assertThat (columnInfos .toList (ci -> {
49- throw new IllegalStateException ("This should never get called" );
50- })).isEmpty ();
51+ assertThat (columnInfos .toColumnList (TABLE )).isEmpty ();
5152 }
5253
53- @ Test // GH-574
54+ @ Test
55+ // GH-574
5456 void singleElementColumnInfos () {
5557
5658 AggregatePath .ColumnInfos columnInfos = basePath (DummyEntity .class ).getTableInfo ().idColumnInfos ();
5759
5860 assertThat (columnInfos .isEmpty ()).isFalse ();
5961 assertThat (columnInfos .any ().name ()).isEqualTo (ID );
6062 assertThat (columnInfos .unique ().name ()).isEqualTo (ID );
61- assertThat (columnInfos .toList ( ci -> ci . name ())) .containsExactly (ID );
63+ assertThat (columnInfos .toColumnList ( TABLE )) .containsExactly (TABLE . column ( ID ) );
6264 }
6365
6466 @ Test // GH-574
@@ -69,10 +71,10 @@ void multiElementColumnInfos() {
6971 assertThat (columnInfos .isEmpty ()).isFalse ();
7072 assertThat (columnInfos .any ().name ()).isEqualTo (SqlIdentifier .quoted ("ONE" ));
7173 assertThrows (IllegalStateException .class , columnInfos ::unique );
72- assertThat (columnInfos .toList ( ci -> ci . name () )) //
74+ assertThat (columnInfos .toColumnList ( TABLE )) //
7375 .containsExactly ( //
74- SqlIdentifier .quoted ("ONE" ), //
75- SqlIdentifier .quoted ("TWO" ) //
76+ TABLE . column ( SqlIdentifier .quoted ("ONE" ) ), //
77+ TABLE . column ( SqlIdentifier .quoted ("TWO" ) ) //
7678 );
7779
7880 List <String > collector = new ArrayList <>();
0 commit comments