Skip to content

Commit

Permalink
HBX-2751: Create helper class HqlCompletionRequestor for use in HqlCo…
Browse files Browse the repository at this point in the history
…deAssistWrapper implementation

  - Add new test case 'org.hibernate.tool.orm.jbt.internal.util.HqlCompletionRequestorTest#testCompletionFailure()'
  - Implement method 'org.hibernate.tool.orm.jbt.internal.util.HqlCompletionRequestor#completionFailure(String)'

Signed-off-by: Koen Aers <koen.aers@gmail.com>
  • Loading branch information
koentsje committed Mar 18, 2024
1 parent 561bea2 commit 734d083
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ public boolean accept(HQLCompletionProposal proposal) {

@Override
public void completionFailure(String errorMessage) {
// TODO Auto-generated method stub

try {
handler.getClass()
.getMethod("completionFailure", new Class[] { String.class })
.invoke(handler, errorMessage);
} catch (Throwable t) {
throw new RuntimeException(t);
}
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.hibernate.tool.orm.jbt.internal.util;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
Expand Down Expand Up @@ -41,4 +42,12 @@ public void testAccept() {
assertSame(objectToAccept, acceptedObject);
}

@Test
public void testCompletionFailure() {
assertNull(message);
hqlCompletionRequestor.completionFailure("foobar");
assertNotNull(message);
assertEquals("foobar", message);
}

}

0 comments on commit 734d083

Please sign in to comment.