Analysis: Add unit tests for the graph base classes
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.graph.core.tests / stubs / org / eclipse / tracecompass / analysis / graph / core / tests / stubs / TestGraphWorker.java
diff --git a/analysis/org.eclipse.tracecompass.analysis.graph.core.tests/stubs/org/eclipse/tracecompass/analysis/graph/core/tests/stubs/TestGraphWorker.java b/analysis/org.eclipse.tracecompass.analysis.graph.core.tests/stubs/org/eclipse/tracecompass/analysis/graph/core/tests/stubs/TestGraphWorker.java
new file mode 100644 (file)
index 0000000..25e0c48
--- /dev/null
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2015 École Polytechnique de Montréal
+ *
+ * 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:
+ *   Geneviève Bastien - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.analysis.graph.core.tests.stubs;
+
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.analysis.graph.core.base.IGraphWorker;
+
+/**
+ * A stub graph worker for unit tests
+ *
+ * @author Geneviève Bastien
+ */
+public class TestGraphWorker implements IGraphWorker {
+
+    private final Integer fValue;
+
+    /**
+     * Constructor
+     *
+     * @param i An integer to represent this worker
+     */
+    public TestGraphWorker(final Integer i) {
+        fValue = i;
+    }
+
+    @Override
+    public String getHostId() {
+        return "test";
+    }
+
+    @Override
+    public int hashCode() {
+        return fValue.hashCode();
+    }
+
+    @Override
+    public boolean equals(@Nullable Object obj) {
+        if (obj instanceof TestGraphWorker) {
+            return fValue.equals(((TestGraphWorker) obj).fValue);
+        }
+        return false;
+    }
+}
\ No newline at end of file
This page took 0.041573 seconds and 5 git commands to generate.