KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > junit > launcher > ContainerTestSearchExtent


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

13
14 /**
15  *
16  */

17 package org.eclipse.jdt.internal.junit.launcher;
18
19 import java.util.HashSet JavaDoc;
20 import java.util.Set JavaDoc;
21
22 import org.eclipse.core.runtime.IProgressMonitor;
23
24 import org.eclipse.jdt.core.IJavaElement;
25 import org.eclipse.jdt.core.IType;
26 import org.eclipse.jdt.core.JavaCore;
27
28
29 class ContainerTestSearchExtent implements ITestSearchExtent {
30     private final IProgressMonitor fPm;
31
32     private final String JavaDoc fHandle;
33
34     ContainerTestSearchExtent(IProgressMonitor pm, String JavaDoc handle) {
35         fPm = pm;
36         fHandle = handle;
37     }
38
39     public IType[] find(ITestFinder finder) {
40         IJavaElement container = JavaCore.create(fHandle);
41         Set JavaDoc result = new HashSet JavaDoc();
42         finder.findTestsInContainer(new Object JavaDoc[] { container }, result, fPm);
43         return (IType[]) result.toArray(new IType[result.size()]);
44     }
45 }
Popular Tags