analysis: Move plugins to their own sub-directory
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.core.tests / src / org / eclipse / tracecompass / tmf / core / tests / filter / TmfFilterRootNodeTest.java
CommitLineData
ebc1e992
PT
1/*******************************************************************************
2 * Copyright (c) 2015 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 * Contributors:
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
12
13package org.eclipse.tracecompass.tmf.core.tests.filter;
14
15import static org.junit.Assert.assertArrayEquals;
16import static org.junit.Assert.assertEquals;
17import static org.junit.Assert.assertFalse;
18import static org.junit.Assert.assertTrue;
19
20import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
21import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
22import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
23import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterNode;
24import org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterRootNode;
25import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
26import org.junit.Before;
27import org.junit.Test;
28
29/**
30 * Test suite for the {@link TmfFilterRootNode} class.
31 *
32 * @author Patrick Tasse
33 */
34@SuppressWarnings("javadoc")
35public class TmfFilterRootNodeTest extends TmfFilterTreeNodeTest {
36
37 // ------------------------------------------------------------------------
38 // Variables
39 // ------------------------------------------------------------------------
40
41 private ITmfEventField fContent = new TmfEventField(ITmfEventField.ROOT_FIELD_ID, null, null);
42 private TmfEvent fEvent = new TmfEvent(TRACE, 0, new TmfNanoTimestamp(1), EVENT_TYPE, fContent);
43 private TmfFilterRootNode fFilter;
44
45 // ------------------------------------------------------------------------
46 // Tests
47 // ------------------------------------------------------------------------
48
49 @Before
50 public void createFilter() {
51 fFilter = new TmfFilterRootNode();
52 fFilterNode = fFilter;
53 }
54
55 @Test
56 public void testMatches() {
57 fFilter.addChild(TRUE_NODE);
58 fFilter.addChild(TRUE_NODE);
59 assertTrue(fFilter.matches(fEvent));
60
61 fFilter.replaceChild(0, FALSE_NODE);
62 assertFalse(fFilter.matches(fEvent));
63 }
64
65 @Test
66 public void testGetName() {
67 assertEquals("getName()", "ROOT", fFilter.getNodeName());
68 }
69
70 @Test
71 public void testGetValidChildren() {
72 assertArrayEquals("getValidChildren()", new String[] { TmfFilterNode.NODE_NAME }, fFilter.getValidChildren().toArray());
73 }
74}
This page took 0.034158 seconds and 5 git commands to generate.