rcp: Move plugins to their own sub-directory
[deliverable/tracecompass.git] / org.eclipse.tracecompass.ctf.core.tests / src / org / eclipse / tracecompass / ctf / core / tests / types / DefinitionTest.java
CommitLineData
4bd7f2db 1/*******************************************************************************
ed902a2b 2 * Copyright (c) 2013, 2014 Ericsson
4bd7f2db
AM
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Matthew Khouzam - Initial API and implementation
10 *******************************************************************************/
11
f357bcd4 12package org.eclipse.tracecompass.ctf.core.tests.types;
866e5b51
FC
13
14import static org.junit.Assert.assertNotNull;
15
a4fa4e36 16import org.eclipse.jdt.annotation.NonNull;
f357bcd4
AM
17import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
18import org.eclipse.tracecompass.ctf.core.event.types.Definition;
d890ec37 19import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
f357bcd4
AM
20import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
21import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
22import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
866e5b51
FC
23import org.junit.Test;
24
25/**
26 * The class <code>DefinitionTest</code> contains tests for the class
27 * <code>{@link Definition}</code>.
9ac2eb62 28 *
a4fa4e36 29 * @author Matthew Khouzam
866e5b51
FC
30 * @version $Revision: 1.0 $
31 */
32public class DefinitionTest {
33
866e5b51
FC
34 /**
35 * Since Definition is abstract, we'll minimally extend it here to
36 * instantiate it.
37 */
a4fa4e36 38 static class DefTest extends Definition {
866e5b51 39
a4fa4e36 40 @NonNull
d890ec37 41 private static final StringDeclaration STRINGDEC = StringDeclaration.getStringDeclaration(Encoding.UTF8);
866e5b51 42
a4fa4e36 43 public DefTest(IDefinitionScope definitionScope, @NonNull String fieldName) {
d890ec37 44 super(DefTest.STRINGDEC, definitionScope, fieldName);
866e5b51
FC
45 }
46
9ac2eb62 47 @Override
a4fa4e36 48 @NonNull
9ac2eb62 49 public IDeclaration getDeclaration() {
d890ec37 50 return DefTest.STRINGDEC;
9ac2eb62
MK
51 }
52
866e5b51
FC
53 }
54
a4fa4e36
MK
55 /**
56 * Test a definition
57 */
866e5b51 58 @Test
79cb3749 59 public void testToString() {
cc98c947 60 IDefinition fixture = new DefTest(null, "Hello");
866e5b51
FC
61 String result = fixture.toString();
62
63 assertNotNull(result);
64 }
65}
This page took 0.064383 seconds and 5 git commands to generate.