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 15
15
import net .sf .jsqlparser .schema .Column ;
16
16
import net .sf .jsqlparser .schema .Table ;
17
17
import static net .sf .jsqlparser .test .TestUtils .assertSqlCanBeParsedAndDeparsed ;
18
+ import static org .assertj .core .api .Assertions .assertThat ;
18
19
import static org .junit .Assert .assertEquals ;
19
20
import org .junit .Test ;
20
21
@@ -73,4 +74,22 @@ public void testToString() {
73
74
public void testCommentColumnDeparseIssue696 () throws JSQLParserException {
74
75
assertSqlCanBeParsedAndDeparsed ("COMMENT ON COLUMN hotels.hotelid IS 'Primary key of the table'" );
75
76
}
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
+ }
76
95
}
You can’t perform that action at this time.
0 commit comments