/*******************************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Francois Chouinard - Initial API and implementation
*******************************************************************************/
import org.eclipse.linuxtools.tmf.core.event.TmfEventTypeManager;
/**
- * <b><u>TmfEventTypeManagerTest</u></b>
- * <p>
* Test suite for the TmfEventTypeManager class.
- * <p>
*/
@SuppressWarnings("nls")
public class TmfEventTypeManagerTest extends TestCase {
// Getters
// ------------------------------------------------------------------------
+ /**
+ *
+ */
public void testGetContexts() {
fInstance.clear();
fInstance.add(fContext1, fType0);
assertEquals("getContexts", fContext2, contexts[1]);
}
+ /**
+ *
+ */
public void testGetTypes() {
fInstance.clear();
fInstance.add(fContext1, fType0);
ITmfEventType[] types = fInstance.getTypes(fContext1);
assertEquals("getTypes", 2, types.length);
- if (fType0 == types[0])
+ if (fType0 == types[0]) {
assertSame("getTypes", fType1, types[1]);
- else {
+ } else {
assertSame("getTypes", fType0, types[1]);
assertSame("getTypes", fType1, types[0]);
}
types = fInstance.getTypes(fContext2);
assertEquals("getTypes", 2, types.length);
- if (fType2 == types[0])
+ if (fType2 == types[0]) {
assertSame("getTypes", fType3, types[1]);
- else {
+ } else {
assertSame("getTypes", fType2, types[1]);
assertSame("getTypes", fType3, types[0]);
}
}
+ /**
+ *
+ */
public void testGetType() {
fInstance.clear();
fInstance.add(fContext1, fType0);
// Operations
// ------------------------------------------------------------------------
+ /**
+ *
+ */
public void testClear() {
fInstance.clear();
assertEquals("clear", 0, fInstance.getContexts().length);
- assertNull("clear", fInstance.getTypes(null));
+ assertEquals("clear", 0, fInstance.getTypes(null).length);
assertNull("clear", fInstance.getType(null, null));
assertEquals("clear", "TmfEventTypeManager [fEventTypes={}]", fInstance.toString());
}
+ /**
+ *
+ */
public void testClearContext() {
fInstance.clear();
fInstance.add(fContext1, fType0);
assertEquals("clear context", fContext2, contexts[0]);
ITmfEventType[] types = fInstance.getTypes(fContext1);
- assertNull("clear context", types);
+ assertEquals("clear context", 0, types.length);
ITmfEventType type = fInstance.getType(fContext1, fType0.getName());
assertNull("clear context", type);
types = fInstance.getTypes(fContext2);
assertEquals("clear context", 2, types.length);
- if (fType2 == types[0])
+ if (fType2 == types[0]) {
assertSame("clear context", fType3, types[1]);
- else {
+ } else {
assertSame("clear context", fType2, types[1]);
assertSame("clear context", fType3, types[0]);
}
}
+ /**
+ *
+ */
public void testBasicAdd() {
fInstance.clear();
fInstance.add(fContext1, fType0);
assertNotSame("add", fType0, type);
}
+ /**
+ *
+ */
public void testAdd() {
fInstance.clear();
fInstance.add(fContext1, fType0);
ITmfEventType[] types = fInstance.getTypes(fContext1);
assertEquals("add", 2, types.length);
- if (fType0 == types[0])
+ if (fType0 == types[0]) {
assertSame("add", fType1, types[1]);
- else {
+ } else {
assertSame("add", fType0, types[1]);
assertSame("add", fType1, types[0]);
}
types = fInstance.getTypes(fContext2);
assertEquals("add", 2, types.length);
- if (fType2 == types[0])
+ if (fType2 == types[0]) {
assertSame("add", fType3, types[1]);
- else {
+ } else {
assertSame("add", fType2, types[1]);
assertSame("add", fType3, types[0]);
}
// Object
// ------------------------------------------------------------------------
+ /**
+ *
+ */
public void testToString() {
fInstance.clear();
assertEquals("toString", "TmfEventTypeManager [fEventTypes={}]", fInstance.toString());