/hg/rhino-tests: Added 16 new negative tests to the test suite s...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Thu Aug 16 02:56:09 PDT 2012
changeset 23e45df03db4 in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=23e45df03db4
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Thu Aug 16 11:58:45 2012 +0200
Added 16 new negative tests to the test suite src/org/RhinoTests/ScriptEngineTest.java.
diffstat:
ChangeLog | 5 +
src/org/RhinoTests/ScriptEngineTest.java | 167 +++++++++++++++++++++++++++++++
2 files changed, 172 insertions(+), 0 deletions(-)
diffs (189 lines):
diff -r 425a6823067b -r 23e45df03db4 ChangeLog
--- a/ChangeLog Wed Aug 15 13:48:07 2012 +0200
+++ b/ChangeLog Thu Aug 16 11:58:45 2012 +0200
@@ -1,3 +1,8 @@
+2012-08-16 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/RhinoTests/ScriptEngineTest.java:
+ Added 16 new negative tests.
+
2012-08-15 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/RhinoTests/ScriptContextClassTest.java:
diff -r 425a6823067b -r 23e45df03db4 src/org/RhinoTests/ScriptEngineTest.java
--- a/src/org/RhinoTests/ScriptEngineTest.java Wed Aug 15 13:48:07 2012 +0200
+++ b/src/org/RhinoTests/ScriptEngineTest.java Thu Aug 16 11:58:45 2012 +0200
@@ -507,6 +507,173 @@
}
/**
+ * Test if NPE is thrown if getEngineByMimeType() is called with null.
+ * @throws Exception if this test case fails.
+ */
+ protected void testGetEngineByMimeTypeNegative1() throws Exception {
+ assertNotNull(engineManager, "Script engine manager was not created");
+ try {
+ @SuppressWarnings("unused")
+ ScriptEngine scriptEngine = this.engineManager.getEngineByMimeType(null);
+ }
+ catch (NullPointerException e)
+ {
+ return;
+ }
+ throw new Exception("NPE was not thrown as expected");
+ }
+
+ /**
+ * Test if none script engine is found using wrong MIME type.
+ * @throws Exception if this test case fails.
+ */
+ protected void testGetEngineByMimeTypeNegative2() throws Exception {
+ assertNotNull(engineManager, "Script engine manager was not created");
+ ScriptEngine scriptEngine = this.engineManager.getEngineByMimeType("");
+ assertNull(scriptEngine, "JavaScript engine manager was found but it's not expected");
+ }
+
+ /**
+ * Test if none script engine is found using wrong MIME type.
+ * @throws Exception if this test case fails.
+ */
+ protected void testGetEngineByMimeTypeNegative3() throws Exception {
+ assertNotNull(engineManager, "Script engine manager was not created");
+ ScriptEngine scriptEngine = this.engineManager.getEngineByMimeType(" ");
+ assertNull(scriptEngine, "JavaScript engine manager was found but it's not expected");
+ }
+
+ /**
+ * Test if none script engine is found using wrong MIME type.
+ * @throws Exception if this test case fails.
+ */
+ protected void testGetEngineByMimeTypeNegative4() throws Exception {
+ assertNotNull(engineManager, "Script engine manager was not created");
+ ScriptEngine scriptEngine = this.engineManager.getEngineByMimeType(" ");
+ assertNull(scriptEngine, "JavaScript engine manager was found but it's not expected");
+ }
+
+ /**
+ * Test if none script engine is found using wrong MIME type.
+ * @throws Exception if this test case fails.
+ */
+ protected void testGetEngineByMimeTypeNegative5() throws Exception {
+ assertNotNull(engineManager, "Script engine manager was not created");
+ ScriptEngine scriptEngine = this.engineManager.getEngineByMimeType("\t");
+ assertNull(scriptEngine, "JavaScript engine manager was found but it's not expected");
+ }
+
+ /**
+ * Test if none script engine is found using wrong MIME type.
+ * @throws Exception if this test case fails.
+ */
+ protected void testGetEngineByMimeTypeNegative6() throws Exception {
+ assertNotNull(engineManager, "Script engine manager was not created");
+ ScriptEngine scriptEngine = this.engineManager.getEngineByMimeType(" \t");
+ assertNull(scriptEngine, "JavaScript engine manager was found but it's not expected");
+ }
+
+ /**
+ * Test if none script engine is found using wrong MIME type.
+ * @throws Exception if this test case fails.
+ */
+ protected void testGetEngineByMimeTypeNegative7() throws Exception {
+ assertNotNull(engineManager, "Script engine manager was not created");
+ ScriptEngine scriptEngine = this.engineManager.getEngineByMimeType("\b");
+ assertNull(scriptEngine, "JavaScript engine manager was found but it's not expected");
+ }
+
+ /**
+ * Test if none script engine is found using wrong MIME type.
+ * @throws Exception if this test case fails.
+ */
+ protected void testGetEngineByMimeTypeNegative8() throws Exception {
+ assertNotNull(engineManager, "Script engine manager was not created");
+ ScriptEngine scriptEngine = this.engineManager.getEngineByMimeType("\b\b");
+ assertNull(scriptEngine, "JavaScript engine manager was found but it's not expected");
+ }
+
+ /**
+ * Test if none script engine is found using wrong MIME type.
+ * @throws Exception if this test case fails.
+ */
+ protected void testGetEngineByMimeTypeNegative9() throws Exception {
+ assertNotNull(engineManager, "Script engine manager was not created");
+ ScriptEngine scriptEngine = this.engineManager.getEngineByMimeType(" \b\b");
+ assertNull(scriptEngine, "JavaScript engine manager was found but it's not expected");
+ }
+
+ /**
+ * Test if none script engine is found using wrong MIME type.
+ * @throws Exception if this test case fails.
+ */
+ protected void testGetEngineByMimeTypeNegative10() throws Exception {
+ assertNotNull(engineManager, "Script engine manager was not created");
+ ScriptEngine scriptEngine = this.engineManager.getEngineByMimeType("\000");
+ assertNull(scriptEngine, "JavaScript engine manager was found but it's not expected");
+ }
+
+ /**
+ * Test if none script engine is found using wrong MIME type.
+ * @throws Exception if this test case fails.
+ */
+ protected void testGetEngineByMimeTypeNegative11() throws Exception {
+ assertNotNull(engineManager, "Script engine manager was not created");
+ ScriptEngine scriptEngine = this.engineManager.getEngineByMimeType("\u0000");
+ assertNull(scriptEngine, "JavaScript engine manager was found but it's not expected");
+ }
+
+ /**
+ * Test if none script engine is found using wrong MIME type.
+ * @throws Exception if this test case fails.
+ */
+ protected void testGetEngineByMimeTypeNegative12() throws Exception {
+ assertNotNull(engineManager, "Script engine manager was not created");
+ ScriptEngine scriptEngine = this.engineManager.getEngineByMimeType("js ");
+ assertNull(scriptEngine, "JavaScript engine manager was found but it's not expected");
+ }
+
+ /**
+ * Test if none script engine is found using wrong MIME type.
+ * @throws Exception if this test case fails.
+ */
+ protected void testGetEngineByMimeTypeNegative13() throws Exception {
+ assertNotNull(engineManager, "Script engine manager was not created");
+ ScriptEngine scriptEngine = this.engineManager.getEngineByMimeType("\tjs");
+ assertNull(scriptEngine, "JavaScript engine manager was found but it's not expected");
+ }
+
+ /**
+ * Test if none script engine is found using wrong MIME type.
+ * @throws Exception if this test case fails.
+ */
+ protected void testGetEngineByMimeTypeNegative14() throws Exception {
+ assertNotNull(engineManager, "Script engine manager was not created");
+ ScriptEngine scriptEngine = this.engineManager.getEngineByMimeType("js\t");
+ assertNull(scriptEngine, "JavaScript engine manager was found but it's not expected");
+ }
+
+ /**
+ * Test if none script engine is found using wrong MIME type.
+ * @throws Exception if this test case fails.
+ */
+ protected void testGetEngineByMimeTypeNegative15() throws Exception {
+ assertNotNull(engineManager, "Script engine manager was not created");
+ ScriptEngine scriptEngine = this.engineManager.getEngineByMimeType(" js");
+ assertNull(scriptEngine, "JavaScript engine manager was found but it's not expected");
+ }
+
+ /**
+ * Test if none script engine is found using wrong MIME type.
+ * @throws Exception if this test case fails.
+ */
+ protected void testGetEngineByMimeTypeNegative16() throws Exception {
+ assertNotNull(engineManager, "Script engine manager was not created");
+ ScriptEngine scriptEngine = this.engineManager.getEngineByMimeType("\bjs");
+ assertNull(scriptEngine, "JavaScript engine manager was found but it's not expected");
+ }
+
+ /**
* Check if two script engine factories are equals.
* @throws Exception thrown if script engine factories are not equals.
*/
More information about the distro-pkg-dev
mailing list