Package org.jooq.test.data

Examples of org.jooq.test.data.Table1Record


            .insertInto(TABLE1, FIELD_ID1)
            .values(1)
            .returning();

        assertEquals(1, query.execute());
        Table1Record record = query.fetchOne();

        assertEquals(1, (int) record.getValue(FIELD_ID1));
        assertEquals("1", record.getValue(FIELD_NAME1));
    }
View Full Code Here


*/
public class RecordTest extends AbstractTest {

    @Test
    public void testComparableRecords() throws Exception {
        Table1Record r1 = create.newRecord(Table1.TABLE1);
        Table2Record r2 = create.newRecord(Table2.TABLE2);
        Table4Record r4a = create.newRecord(Table4.TABLE4);
        Table4Record r4b = create.newRecord(Table4.TABLE4);

        // Incomparable (incompatible) records
        try {
            r1.compareTo(r4a);
            fail();
        }
        catch (ClassCastException expected) {}

        // Comparable records
        assertEquals(0, r1.compareTo(r2));
        assertEquals(0, r4a.compareTo(r4b));

        r2.setValue(Table2.FIELD_ID2, 1);
        assertEquals(1, r1.compareTo(r2));

        r2.setValue(Table2.FIELD_NAME2, "1");
        assertEquals(1, r1.compareTo(r2));

        r1.setValue(Table1.FIELD_ID1, 1);
        assertEquals(1, r1.compareTo(r2));

        r1.setValue(Table1.FIELD_NAME1, "1");
        assertEquals(0, r1.compareTo(r2));

        r2.setValue(Table2.FIELD_ID2, null);
        assertEquals(-1, r1.compareTo(r2));

        // Arrays
        r4b.setValue(Table4.FIELD_ARRAY4, new Object[] { 1 });
        assertEquals(1, r4a.compareTo(r4b));

View Full Code Here

        assertEquals(-1, r4a.compareTo(r4b));
    }

    @Test
    public void testRecordInto() {
        Table1Record r1 = create.newRecord(Table1.TABLE1);
        r1.setValue(Table1.FIELD_ID1, 1);
        r1.setValue(Table1.FIELD_NAME1, "x");

        Record1<Integer> r2 = r1.into(Table1.FIELD_ID1);
        assertEquals(1, r2.size());
        assertEquals(Table1.FIELD_ID1, r2.field(0));
        assertEquals(1, (int) r2.value1());
        assertTrue(r2.changed());

        r1.changed(false);
        r2 = r1.into(Table1.FIELD_ID1);
        assertEquals(1, r2.size());
        assertEquals(Table1.FIELD_ID1, r2.field(0));
        assertEquals(1, (int) r2.value1());
        assertFalse(r2.changed());
    }
View Full Code Here

TOP

Related Classes of org.jooq.test.data.Table1Record

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.