/** * Init. */ @BeforeMethod public void init() { arrayBasedStorageLeaf = new ArrayBasedStorageLeaf<>(LEAF_ID); }
/** * Tests that the indexing the same element in the {@link ArrayBasedStorageLeaf} will thrown a * exception. * * @throws IndexingException * {@link IndexingException} */ @Test(expectedExceptions = { IndexingException.class }) public void indexSameElement() throws IndexingException { ArrayBasedStorageLeaf<DefaultData> arrayBasedStorageLeaf = new ArrayBasedStorageLeaf<>(); DefaultData defaultData = mock(DefaultData.class); when(defaultData.getId()).thenReturn(1L); arrayBasedStorageLeaf.put(defaultData); arrayBasedStorageLeaf.put(defaultData); }
/** * Test the removing of the element in the {@link ArrayBasedStorageLeaf}. * * @throws IndexingException * {@link IndexingException} */ @Test public void removeElement() throws IndexingException { ArrayBasedStorageLeaf<DefaultData> arrayBasedStorageLeaf = new ArrayBasedStorageLeaf<>(); DefaultData defaultData = mock(DefaultData.class); when(defaultData.getId()).thenReturn(1L); arrayBasedStorageLeaf.put(defaultData); assertThat(arrayBasedStorageLeaf.getAndRemove(defaultData), is(notNullValue())); assertThat(arrayBasedStorageLeaf.get(defaultData), is(nullValue())); assertThat(arrayBasedStorageLeaf.query(storageIndexQuery), is(empty())); // Test for forkJoinPool assertThat(arrayBasedStorageLeaf.query(storageIndexQuery, forkJoinPool), is(empty())); }
return new ArrayBasedStorageLeaf<>(id); } else { return new ArrayBasedStorageLeaf<>();
ArrayBasedStorageLeaf<DefaultData> arrayBasedStorageLeaf = new ArrayBasedStorageLeaf<>();
indexingTree = new ArrayBasedStorageLeaf<>();