Tests that Hook#PARSE_TREE works.
()
| 7770 | |
| 7771 | /** Tests that {@link Hook#PARSE_TREE} works. */ |
| 7772 | @Test void testHook() { |
| 7773 | final int[] callCount = {0}; |
| 7774 | try (Hook.Closeable ignored = |
| 7775 | Hook.PARSE_TREE.<Object[]>addThread(args -> { |
| 7776 | assertThat(args, arrayWithSize(2)); |
| 7777 | assertThat(args[0], instanceOf(String.class)); |
| 7778 | assertThat(args[0], |
| 7779 | is("select \"deptno\", \"commission\", sum(\"salary\") s\n" |
| 7780 | + "from \"hr\".\"emps\"\n" |
| 7781 | + "group by \"deptno\", \"commission\"")); |
| 7782 | assertThat(args[1], instanceOf(SqlSelect.class)); |
| 7783 | ++callCount[0]; |
| 7784 | })) { |
| 7785 | // Simple query does not run the hook. |
| 7786 | testSimple(); |
| 7787 | assertThat(callCount[0], is(0)); |
| 7788 | |
| 7789 | // Non-trivial query runs hook once. |
| 7790 | testGroupByNull(); |
| 7791 | assertThat(callCount[0], is(1)); |
| 7792 | } |
| 7793 | } |
| 7794 | |
| 7795 | /** Tests {@link SqlDialect}. */ |
| 7796 | @Test void testDialect() { |
nothing calls this directly
no test coverage detected