File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 1515import net .sf .jsqlparser .schema .Column ;
1616import net .sf .jsqlparser .schema .Table ;
1717import static net .sf .jsqlparser .test .TestUtils .assertSqlCanBeParsedAndDeparsed ;
18+ import static org .assertj .core .api .Assertions .assertThat ;
1819import static org .junit .Assert .assertEquals ;
1920import org .junit .Test ;
2021
@@ -73,4 +74,22 @@ public void testToString() {
7374 public void testCommentColumnDeparseIssue696 () throws JSQLParserException {
7475 assertSqlCanBeParsedAndDeparsed ("COMMENT ON COLUMN hotels.hotelid IS 'Primary key of the table'" );
7576 }
77+
78+ @ Test
79+ public void testCommentTableColumnDiffersIssue984 () throws JSQLParserException {
80+ Comment comment = (Comment ) CCJSqlParserUtil .parse ("COMMENT ON COLUMN myTable.myColumn is 'Some comment'" );
81+ assertThat (comment .getTable ()).isNull ();
82+ assertThat (comment .getColumn ().getColumnName ()).isEqualTo ("myColumn" );
83+ assertThat (comment .getColumn ().getTable ().getFullyQualifiedName ()).isEqualTo ("myTable" );
84+ }
85+
86+ @ Test
87+ public void testCommentTableColumnDiffersIssue984_2 () throws JSQLParserException {
88+ Comment comment = (Comment ) CCJSqlParserUtil .parse ("COMMENT ON COLUMN mySchema.myTable.myColumn is 'Some comment'" );
89+ assertThat (comment .getTable ()).isNull ();
90+ assertThat (comment .getColumn ().getColumnName ()).isEqualTo ("myColumn" );
91+ assertThat (comment .getColumn ().getTable ().getFullyQualifiedName ()).isEqualTo ("mySchema.myTable" );
92+ assertThat (comment .getColumn ().getTable ().getName ()).isEqualTo ("myTable" );
93+ assertThat (comment .getColumn ().getTable ().getSchemaName ()).isEqualTo ("mySchema" );
94+ }
7695}
You can’t perform that action at this time.
0 commit comments