|
What this is
This file is included in the DevDaily.com
"Java Source Code
Warehouse" project. The intent of this project is to help you "Learn
Java by Example" TM.
Other links
The source code
/*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License
* Version 1.0 (the "License"). You may not use this file except in
* compliance with the License. A copy of the License is available at
* http://www.sun.com/
*
* The Original Code is NetBeans. The Initial Developer of the Original
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
* Microsystems, Inc. All Rights Reserved.
*/
/*
* ForName.java
*
* Created on September 19, 2000, 1:39 PM
*/
package org.netbeans.test.java.integrity.ForName;
import junit.textui.TestRunner;
import org.netbeans.test.java.LogTestCase;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
import org.openide.loaders.DataObject;
import org.openide.src.ClassElement;
/** Java Module Integrity API Test: ForName
*
What it tests:
* Capability of module to search through mounted filesystems for specified Class.
*
What has to be set:
* testbase/testfs has to be mounted.
*
How it works:
* Test tries to find known classes using ClassElement.forName(ClassElement);
*
Output:
* Places, where were known classes found. This is compared with golden file.
*
Possible reasons of failure:
*
Some classes were not found
* See .diff file which ones.
*
Exception occured:
* See .out or .diff file for StackTrace
*
* @author Jan Becicka
* @version
*/
public class ForName extends LogTestCase {
public void testRun(){
try {
FileObject artefact=FileUtil.toFileObject(classPathWorkDir);
for (int i=0;i < Classes.length;i++){
ClassElement ce = ClassElement.forName(Classes[i], artefact);
if (ce == null){
ref(Classes[i]+" not found!");
} else {
ref(Classes[i]+" found");// in "+ getFSName(ce));
}
}
} catch (Exception e) {
e.printStackTrace(log);
assertTrue(e.toString(), false);
}
}
public static void main(java.lang.String[] args) {
TestRunner.run(ForName.class);
}
final String[] Classes = {
"TopLevelClassDefaultPackage",
"TopLevelClassDefaultPackage.InnerClass",
"TopLevelClassDefaultPackage$InnerClass",
"org.netbeans.test.java.testsources.TopLevelClass",
"org.netbeans.test.java.testsources.TopLevelClass.InnerClass",
"org.netbeans.test.java.testsources.TopLevelClass$InnerClass",
"org.netbeans.test.java.testsources.InTestFS",
"org.netbeans.test.java.testsources.InTestFS$InnerClass",
"org.netbeans.test.java.testsources.InTestFS.InnerClass",
};
public ForName(java.lang.String testName) {
super(testName);
}
}
|