Search in sources :

Example 1 with SimpleFieldTracker

use of org.hibernate.bytecode.enhance.internal.tracker.SimpleFieldTracker in project hibernate-orm by hibernate.

the class DirtyTrackerTest method testSimpleTracker.

@Test
public void testSimpleTracker() {
    DirtyTracker tracker = new SimpleFieldTracker();
    assertTrue(tracker.isEmpty());
    assertTrue(tracker.get().length == 0);
    tracker.add("foo");
    assertFalse(tracker.isEmpty());
    assertArrayEquals(tracker.get(), new String[] { "foo" });
    tracker.clear();
    assertTrue(tracker.isEmpty());
    assertTrue(tracker.get().length == 0);
    tracker.add("foo");
    tracker.add("bar");
    tracker.add("another.bar");
    tracker.add("foo");
    tracker.add("another.foo");
    tracker.add("another.bar");
    assertTrue(tracker.get().length == 4);
    tracker.suspend(true);
    tracker.add("one more");
    assertTrue(tracker.get().length == 4);
}
Also used : SimpleFieldTracker(org.hibernate.bytecode.enhance.internal.tracker.SimpleFieldTracker) DirtyTracker(org.hibernate.bytecode.enhance.internal.tracker.DirtyTracker) Test(org.junit.Test)

Aggregations

DirtyTracker (org.hibernate.bytecode.enhance.internal.tracker.DirtyTracker)1 SimpleFieldTracker (org.hibernate.bytecode.enhance.internal.tracker.SimpleFieldTracker)1 Test (org.junit.Test)1