KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > junit4 > runner > JUnit4Identifier


1 /*******************************************************************************
2  * Copyright (c) 2006 IBM Corporation and others.
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  * David Saff (saff@mit.edu) - initial API and implementation
10  * (bug 102632: [JUnit] Support for JUnit 4.)
11  *******************************************************************************/

12
13 package org.eclipse.jdt.internal.junit4.runner;
14
15 import org.eclipse.jdt.internal.junit.runner.ITestIdentifier;
16 import org.junit.runner.Description;
17
18 public class JUnit4Identifier implements ITestIdentifier {
19     private final Description fPlan;
20
21     public JUnit4Identifier(Description plan) {
22         this.fPlan= plan;
23     }
24
25     public String JavaDoc getName() {
26         return fPlan.getDisplayName();
27     }
28
29     @Override JavaDoc
30     public int hashCode() {
31         return fPlan.hashCode();
32     }
33
34     @Override JavaDoc
35     public boolean equals(Object JavaDoc obj) {
36         if (! (obj instanceof JUnit4Identifier))
37             return false;
38         
39         JUnit4Identifier id= (JUnit4Identifier) obj;
40         return fPlan.equals(id.fPlan);
41     }
42
43 }
44
Popular Tags