1 /* 2 * The contents of this file are subject to the terms of the Common Development 3 * and Distribution License (the License). You may not use this file except in 4 * compliance with the License. 5 * 6 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html 7 * or http://www.netbeans.org/cddl.txt. 8 * 9 * When distributing Covered Code, include this CDDL Header Notice in each file 10 * and include the License file at http://www.netbeans.org/cddl.txt. 11 * If applicable, add the following below the CDDL Header, with the fields 12 * enclosed by brackets [] replaced by your own identifying information: 13 * "Portions Copyrighted [year] [name of copyright owner]" 14 * 15 * The Original Software is NetBeans. The Initial Developer of the Original 16 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun 17 * Microsystems, Inc. All Rights Reserved. 18 */ 19 20 package org.netbeans.spi.java.queries; 21 22 import java.net.URL; 23 import org.openide.filesystems.FileObject; 24 25 /** 26 * Query to find Java package root of unit tests for Java package root of 27 * sources and vice versa. 28 * 29 * <p>A default implementation is registered by the 30 * <code>org.netbeans.modules.java.project</code> module which looks up the 31 * project corresponding to the binary file and checks whether that 32 * project has an implementation of this interface in its lookup. If so, it 33 * delegates to that implementation. Therefore it is not generally necessary 34 * for a project type provider to register its own global implementation of 35 * this query, if it depends on the Java Project module and uses this style.</p> 36 * 37 * <p>This interface assumes following mapping pattern between source 38 * files and unit tests: <code>*.java -> *Test.java</code>. This mapping 39 * is used for example for unit test generation and for searching test for 40 * source. Usage of any other pattern will break this functionality.</p> 41 * 42 * @see <a HREF="@PROJECTS/PROJECTAPI/org/netbeans/api/project/Project.html#getLookup"><code>Project.getLookup()</code></a> 43 * @see org.netbeans.api.java.queries.UnitTestForSourceQuery 44 * @deprecated Use {@link org.netbeans.spi.java.queries.MultipleRootsUnitTestForSourceQueryImplementation} instead. 45 * @author David Konecny 46 * @since org.netbeans.api.java/1 1.4 47 */ 48 public interface UnitTestForSourceQueryImplementation { 49 50 /** 51 * Returns the test root for a given source root. 52 * 53 * @param source a Java package root with sources 54 * @return a corresponding Java package root with unit tests. The 55 * returned URL need not point to an existing folder. It can be null 56 * when no mapping from source to unit test is known. 57 */ 58 URL findUnitTest(FileObject source); 59 60 /** 61 * Returns the source root for a given test root. 62 * 63 * @param unitTest a Java package root with unit tests 64 * @return a corresponding Java package root with sources. It can be null 65 * when no mapping from unit test to source is known. 66 */ 67 URL findSource(FileObject unitTest); 68 69 } 70