1 /******************************************************************************* 2 * Copyright (c) 2006, 2017 IBM Corporation and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * David Saff (saff@mit.edu) - initial API and implementation 13 * (bug 102632: [JUnit] Support for JUnit 4.) 14 *******************************************************************************/ 15 16 package org.eclipse.jdt.internal.junit4.runner; 17 18 import org.junit.runner.Description; 19 20 import org.eclipse.jdt.internal.junit.runner.ITestIdentifier; 21 22 public class JUnit4Identifier implements ITestIdentifier { 23 private final Description fPlan; 24 JUnit4Identifier(Description plan)25 public JUnit4Identifier(Description plan) { 26 this.fPlan= plan; 27 } 28 getName()29 public String getName() { 30 return fPlan.getDisplayName(); 31 } 32 33 @Override hashCode()34 public int hashCode() { 35 return fPlan.hashCode(); 36 } 37 38 @Override equals(Object obj)39 public boolean equals(Object obj) { 40 if (! (obj instanceof JUnit4Identifier)) 41 return false; 42 43 JUnit4Identifier id= (JUnit4Identifier) obj; 44 return fPlan.equals(id.fPlan); 45 } 46 getDisplayName()47 public String getDisplayName() { 48 return getName(); 49 } 50 getParameterTypes()51 public String getParameterTypes() { 52 return ""; //$NON-NLS-1$ 53 } 54 getUniqueId()55 public String getUniqueId() { 56 return ""; //$NON-NLS-1$ 57 } 58 59 } 60