@Test
public void newInstanceIsDirtyWorks() {

    SampleClass enhanced = enhancer.newInstance();
    assertDirty(enhanced, true);
    ((Snapshot) enhanced).snapshot();
    assertDirty(enhanced, false);
    enhanced.setFoo("foo");
    assertDirty(enhanced, true);
    ((Snapshot) enhanced).snapshot();
    assertDirty(enhanced, false);
    enhanced.setFoo(null);
    assertDirty(enhanced, true);
    enhanced.setFoo("bar");
    assertDirty(enhanced, true);
    enhanced.setFoo("foo");
    assertDirty(enhanced, false);
}