[#3234] Distinguish between integration tests for handling syntax errors (no prepared statement available) vs handling constraint violation errors (prepared statement available)

This commit is contained in:
Lukas Eder 2014-05-06 12:23:37 +02:00
parent 6d482ab35e
commit 2548ec2e06
2 changed files with 24 additions and 3 deletions

View File

@ -381,7 +381,7 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
}
}
public void testExecuteListenerCustomException() throws Exception {
public void testExecuteListenerCustomExceptionOnSyntaxError() throws Exception {
DSLContext create = create(new CustomExceptionListener());
try {
@ -393,6 +393,22 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
}
}
public void testExecuteListenerCustomExceptionOnConstraintViolation() throws Exception {
DSLContext create = create(new CustomExceptionListener());
try {
A author = create.newRecord(TAuthor());
author.setValue(TAuthor_ID(), 1);
author.setValue(TAuthor_LAST_NAME(), "XX");
author.insert();
fail();
}
catch (E e) {
assertEquals("ERROR", e.getMessage());
}
}
public static class CustomExceptionListener extends DefaultExecuteListener {
/**

View File

@ -2632,8 +2632,13 @@ public abstract class jOOQAbstractTest<
}
@Test
public void testExecuteListenerCustomException() throws Exception {
new ExecuteListenerTests(this).testExecuteListenerCustomException();
public void testExecuteListenerCustomExceptionOnSyntaxError() throws Exception {
new ExecuteListenerTests(this).testExecuteListenerCustomExceptionOnSyntaxError();
}
@Test
public void testExecuteListenerCustomExceptionOnConstraintViolation() throws Exception {
new ExecuteListenerTests(this).testExecuteListenerCustomExceptionOnConstraintViolation();
}
@Test