Search in sources :

Example 1 with BreakDetector

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));
}
Also used : BreakDetector(org.simpleflatmapper.map.context.impl.BreakDetector) SampleFieldKey(org.simpleflatmapper.test.map.SampleFieldKey) KeyDefinition(org.simpleflatmapper.map.context.KeyDefinition) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 KeyDefinition (org.simpleflatmapper.map.context.KeyDefinition)1 BreakDetector (org.simpleflatmapper.map.context.impl.BreakDetector)1 SampleFieldKey (org.simpleflatmapper.test.map.SampleFieldKey)1