use of org.simpleflatmapper.map.context.impl.BreakDetector in project SimpleFlatMapper by arnaudroger.
the class Issue366 method testBreakDetector.
@Test
public void testBreakDetector() throws Exception {
KeySourceGetter<SampleFieldKey, Object> keySourceGetter = mock(KeySourceGetter.class);
Object object = new Object();
SampleFieldKey key = new SampleFieldKey("k", 1);
when(keySourceGetter.getValue(key, object)).thenReturn(new byte[] { 1, 2 }, new byte[] { 1, 2 }, new byte[] { 1, 3 });
KeyDefinition<Object, SampleFieldKey> keyDefinition = new KeyDefinition<Object, SampleFieldKey>(new SampleFieldKey[] { key }, keySourceGetter, 0);
BreakDetector<Object> breakDetector = new BreakDetector<Object>(keyDefinition);
assertTrue(breakDetector.broke(object));
assertFalse(breakDetector.broke(object));
assertTrue(breakDetector.broke(object));
}
Aggregations