841ecc8589a7ac7e9b51b83ce056155d6c0091e4
1 /*******************************************************************************
2 * Copyright (c) 2016 EfficiOS Inc., Alexandre Montplaisir
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
10 package org
.eclipse
.tracecompass
.statesystem
.core
.tests
.statevalue
;
12 import static org
.junit
.Assert
.assertEquals
;
13 import static org
.junit
.Assert
.assertFalse
;
15 import org
.eclipse
.tracecompass
.statesystem
.core
.exceptions
.StateValueTypeException
;
16 import org
.eclipse
.tracecompass
.statesystem
.core
.statevalue
.TmfStateValue
;
17 import org
.eclipse
.tracecompass
.statesystem
.core
.statevalue
.ITmfStateValue
;
18 import org
.junit
.Test
;
21 * Base class for state value tests.
23 * By default, it is assumed the state value is *not* null, and throws an
24 * exception for every unbox*() method. Subclasses should override the
25 * appropriate tests to represent their actual behaviour.
27 * @author Alexandre Montplaisir
29 public abstract class StateValueTestBase
{
32 * @return The state value fixture
34 protected abstract ITmfStateValue
getStateValueFixture();
37 * @return The expected type of the state value
39 protected abstract ITmfStateValue
.Type
getStateValueType();
42 * Test the {@link TmfStateValue#getType()} method
45 public final void testGetType() {
46 assertEquals(getStateValueType(), getStateValueFixture().getType());
50 * Test the {@link TmfStateValue#unboxInt()} method
52 @Test(expected
=StateValueTypeException
.class)
53 public void testUnboxInt() {
54 getStateValueFixture().unboxInt();
58 * Test the {@link TmfStateValue#unboxLong()} method
60 @Test(expected
=StateValueTypeException
.class)
61 public void testUnboxLong() {
62 getStateValueFixture().unboxLong();
66 * Test the {@link TmfStateValue#unboxDouble()} method
68 @Test(expected
=StateValueTypeException
.class)
69 public void testUnboxDouble() {
70 getStateValueFixture().unboxDouble();
74 * Test the {@link TmfStateValue#unboxStr()} method
76 @Test(expected
=StateValueTypeException
.class)
77 public void testUnboxStr() {
78 getStateValueFixture().unboxStr();
82 * Test the {@link TmfStateValue#isNull()} method
85 public void testIsNull() {
86 assertFalse(getStateValueFixture().isNull());
This page took 0.037815 seconds and 5 git commands to generate.