Added another integration test checking how copy(), insert() play together

This commit is contained in:
Lukas Eder 2014-06-20 09:51:33 +02:00
parent 2795581a64
commit 99ba7cf8ed
2 changed files with 22 additions and 2 deletions

View File

@ -80,6 +80,8 @@ import org.jooq.exception.InvalidResultException;
import org.jooq.test.BaseTest;
import org.jooq.test.jOOQAbstractTest;
import org.junit.Assume;
public class CRUDTests<
A extends UpdatableRecord<A> & Record6<Integer, String, String, Date, Integer, ?>,
AP,
@ -254,12 +256,25 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
assertEquals(1, r2.store());
assertEquals(0, r3.store());
assertEquals(1, r4.store());
assertEquals(3, create().fetchCount(TTriggers()));
}
assertEquals(3, (int) create().selectCount().from(TTriggers()).fetchOne(0, int.class));
public void testUpdatablesCopyAndInsert() throws Exception {
Assume.assumeNotNull(TTriggers());
jOOQAbstractTest.reset = false;
DSLContext create = create();
T r1 = create.newRecord(TTriggers());
r1.setValue(TTriggers_COUNTER(), 1);
assertEquals(1, r1.store());
T r2 = r1.copy();
assertEquals(1, r2.insert());
assertEquals(2, create.fetchCount(TTriggers()));
}
@SuppressWarnings("unchecked")
public void testUpdatablesKeysMethod() throws Exception {
B b = create().selectFrom(TBook())
.where(TBook_ID().eq(1))

View File

@ -2052,6 +2052,11 @@ public abstract class jOOQAbstractTest<
new CRUDTests(this).testUpdatablesCopy();
}
@Test
public void testUpdatablesCopyAndInsert() throws Exception {
new CRUDTests(this).testUpdatablesCopyAndInsert();
}
@Test
public void testUpdatablesKeysMethod() throws Exception {
new CRUDTests(this).testUpdatablesKeysMethod();