Commit | Line | Data |
---|---|---|
664a3a81 LPD |
1 | /******************************************************************************* |
2 | * Copyright (c) 2016 Ericsson | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | *******************************************************************************/ | |
9 | ||
10 | package org.eclipse.tracecompass.segmentstore.core.tests; | |
11 | ||
12 | import static org.junit.Assert.assertEquals; | |
13 | import static org.junit.Assert.assertFalse; | |
14 | ||
131f8938 MK |
15 | import java.util.Arrays; |
16 | ||
664a3a81 | 17 | import org.eclipse.jdt.annotation.NonNull; |
664a3a81 LPD |
18 | import org.eclipse.tracecompass.segmentstore.core.BasicSegment; |
19 | import org.eclipse.tracecompass.segmentstore.core.ISegment; | |
20 | import org.eclipse.tracecompass.segmentstore.core.ISegmentStore; | |
131f8938 | 21 | import org.eclipse.tracecompass.segmentstore.core.treemap.TreeMapStore; |
664a3a81 LPD |
22 | import org.junit.Test; |
23 | ||
24 | /** | |
25 | * Unit tests for intersecting elements in a TreeMapStore | |
26 | * | |
27 | * @author France Lapointe Nguyen | |
28 | * @deprecated the test is deprecated as the store is deprecated | |
29 | */ | |
30 | @Deprecated | |
31 | public class OldTreeMapStoreTest extends AbstractTestSegmentStore { | |
32 | ||
33 | @Override | |
34 | protected ISegmentStore<@NonNull ISegment> getSegmentStore() { | |
35 | return new TreeMapStore<>(); | |
36 | } | |
37 | ||
131f8938 MK |
38 | @Override |
39 | protected ISegmentStore<@NonNull ISegment> getSegmentStore(@NonNull ISegment @NonNull [] data) { | |
40 | TreeMapStore<@NonNull ISegment> treeMapStore = new TreeMapStore<>(); | |
41 | treeMapStore.addAll(Arrays.asList(data)); | |
42 | return treeMapStore; | |
43 | } | |
44 | ||
664a3a81 LPD |
45 | /** |
46 | * Try adding duplicate elements, they should be ignored | |
47 | */ | |
48 | @Test | |
49 | public void testNoDuplicateElements() { | |
50 | for (ISegment segment : SEGMENTS) { | |
51 | boolean ret = fSegmentStore.add(new BasicSegment(segment.getStart(), segment.getEnd())); | |
52 | assertFalse(ret); | |
53 | } | |
54 | assertEquals(SEGMENTS.size(), fSegmentStore.size()); | |
55 | } | |
56 | } |