[lsc-changes] r431 - in lsc/trunk/src: main/java/org/lsc/jndi test/java/org/lsc/jndi

rschermesser at lsc-project.org rschermesser at lsc-project.org
Mon Nov 9 17:06:19 CET 2009


Author: rschermesser
Date: 2009-11-09 17:06:19 +0100 (Mon, 09 Nov 2009)
New Revision: 431

Modified:
   lsc/trunk/src/main/java/org/lsc/jndi/JndiServices.java
   lsc/trunk/src/test/java/org/lsc/jndi/JScriptEvaluatorTest.java
Log:
Better Junit tests for JScriptEvaluatorTest

Modified: lsc/trunk/src/main/java/org/lsc/jndi/JndiServices.java
===================================================================
--- lsc/trunk/src/main/java/org/lsc/jndi/JndiServices.java	2009-11-09 16:06:10 UTC (rev 430)
+++ lsc/trunk/src/main/java/org/lsc/jndi/JndiServices.java	2009-11-09 16:06:19 UTC (rev 431)
@@ -6,8 +6,8 @@
  * flat files...
  *
  *                  ==LICENSE NOTICE==
- * 
- * Copyright (c) 2008, LSC Project 
+ *
+ * Copyright (c) 2008, LSC Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -21,7 +21,7 @@
  *     * Neither the name of the LSC Project nor the names of its
  * contributors may be used to endorse or promote products derived from
  * this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
@@ -86,9 +86,9 @@
 
 /**
  * General LDAP services wrapper.
- * 
+ *
  * This class is designed to manage all the needed operations to the directory
- * 
+ *
  * @author Sebastien Bahloul <seb at lsc-project.org>
  * @author Jonathan Clarke <jon at lsc-project.org>
  */
@@ -115,7 +115,7 @@
 	private int pageSize;
 
 	private LDAPUrl namingContext;
-	
+
 	/** Support for recursive deletion (default to false) */
 	private boolean recursiveDelete;
 

Modified: lsc/trunk/src/test/java/org/lsc/jndi/JScriptEvaluatorTest.java
===================================================================
--- lsc/trunk/src/test/java/org/lsc/jndi/JScriptEvaluatorTest.java	2009-11-09 16:06:10 UTC (rev 430)
+++ lsc/trunk/src/test/java/org/lsc/jndi/JScriptEvaluatorTest.java	2009-11-09 16:06:19 UTC (rev 431)
@@ -54,9 +54,11 @@
 
 import junit.framework.TestCase;
 
+import org.junit.Test;
 import org.lsc.beans.AbstractBean;
 import org.lsc.beans.personBean;
 import org.lsc.utils.JScriptEvaluator;
+import org.mozilla.javascript.EcmaError;
 
 /**
  * Test different use cases of this JScript evaluator
@@ -72,16 +74,13 @@
 		assertEquals("b", JScriptEvaluator.evalToString("srcAttr.get()", table));
 	}
 
-	public void testNk() {
+	@Test(expected=EcmaError.class)
+	public void testNk() throws EcmaError {
 		Map<String, Object> table = new HashMap<String, Object>();
 		table.put("srcAttr", new BasicAttribute("a", "b"));
 
-		try {
-			assertNull(JScriptEvaluator.evalToString("src.get()", table));
-			assertNull(JScriptEvaluator.evalToStringList("src.get()", table));
-		} catch(Exception e) {
-			//Ignore exceptions, so they are not displayed in any output
-		}
+		assertNull(JScriptEvaluator.evalToString("src.get()", table));
+		assertNull(JScriptEvaluator.evalToStringList("src.get()", table));
 	}
 
 	public void testOk2() {



More information about the lsc-changes mailing list