Update of
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-ejb/src/test/java/org/xdoclet/plugin/ejb
In directory
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7116/plugin-ejb/src/test/java/org/xdoclet/plugin/ejb
Added Files:
EjbUtilsTest.java
Log Message:
alpha commit
--- NEW FILE: EjbUtilsTest.java ---
/*
* Copyright (c) 2005
* XDoclet Team
* All rights reserved.
*/
package org.xdoclet.plugin.ejb;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import java.io.File;
import java.net.URL;
import org.xdoclet.QDoxMetadataProvider;
/**
* TestCase for EjbUtils
*
* @author Diogo Quintela
*/
public class EjbUtilsTest extends TestCase {
private EjbUtils ejbUtils;
public static void main(String[] args) {
junit.textui.TestRunner.run(EjbUtilsTest.class);
}
protected void setUp() throws Exception {
super.setUp();
// Initialize runtime
// TODO: Should we use a "mock" ?
EjbConfig config = new EjbConfig();
String basedir = System.getProperty("xdoclet.ejb.home");
assertNotNull(basedir);
URL reader = new File(basedir +
"/../testapp-ejb/src/main/java").toURL();
EjbRuntime.init(config, new QDoxMetadataProvider(new
File(reader.getPath())));
// Instanciate EjbUtils
this.ejbUtils = new EjbUtils();
}
protected void tearDown() throws Exception {
super.tearDown();
}
public void testGetMethodBySignature() {
testGoodMethodSignature("java.util.Collection findAll()");
testFailingMethodSignature("findAll()");
}
private void testGoodMethodSignature(String signature) {
assertNotNull(signature);
assertNotNull(ejbUtils.getMethodBySignature(signature));
}
private void testFailingMethodSignature(String signature) {
assertNotNull(signature);
try {
fail("Didn't failed has expected:" +
ejbUtils.getMethodBySignature(signature));
} catch (AssertionFailedError e) {
throw e;
} catch (Error e) {
// OK
assertEquals("Invalid finder signature '" + signature + "'",
e.getMessage());
}
}
public void testGetMethodBySignatureWithSingleParamWithName() {
testGoodMethodSignature("java.util.Collection findAll(boolean
argName)");
}
public void testGetMethodBySignatureWithSingleParamWithoutName() {
testGoodMethodSignature("java.util.Collection findAll(boolean)");
}
public void testGetMethodBySignatureWithMultipleParamWithName() {
testGoodMethodSignature("java.util.Collection findAll(boolean a1,int
a2,int a3,int a4,int a5)");
}
public void testGetMethodBySignatureWithMultipleParamWithoutName() {
testGoodMethodSignature("java.util.Collection
findAll(boolean,int,int,int,int)");
}
public void testGetMethodBySignatureWithMultipleParamMixedNames() {
testGoodMethodSignature("java.util.Collection findAll(boolean,int
a2,int,int a4,int a5)");
}
public void testGetMethodBySignatureWithMultipleParamWithArrays() {
testGoodMethodSignature("java.util.Collection findAll(boolean
a1[][][],int[] a2,int[][],int[][] a4[][],int a5)");
}
public void
testGetMethodBySignatureWithMultipleParamWithArraysWithWhitheSpaces() {
testGoodMethodSignature(
"java.util.Collection findAll(boolean a1 [] [] [],int[ ] a2,int[ ]
[],int[ ][ ] a4[] [],int a5)");
testGoodMethodSignature(
"java.util.Collection [][][] findAll(boolean a1 [] [] [],int[ ]
a2,int[ ] [],int[ ][ ] a4[] [],int a5)");
}
public void
testGetMethodBySignatureWithoutParamsUsingIgnorableWhitespaces() {
testGoodMethodSignature("java.util.Collection findAll()");
testGoodMethodSignature("java.util.Collection findAll( )");
testGoodMethodSignature(" java.util.Collection findAll()");
testGoodMethodSignature(" java.util.Collection findAll() ");
testGoodMethodSignature("java.util.Collection findAll () ");
}
}
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
xdoclet-plugins-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xdoclet-plugins-commits