changeset 361:8fa0f2667f65 draft

Added implementation of setUp() and tearDown() methods, added one test.
author ptisnovs
date Fri, 16 May 2014 09:33:09 +0200
parents 7ec0f5310ca5
children bd78ec86c792
files ChangeLog src/org/RhinoTests/SimpleScriptContextTest.java
diffstat 2 files changed, 42 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri May 16 09:21:05 2014 +0200
+++ b/ChangeLog	Fri May 16 09:33:09 2014 +0200
@@ -1,3 +1,8 @@
+2014-05-16  Pavel Tisnovsky  <ptisnovs@redhat.com>
+
+	* src/org/RhinoTests/SimpleScriptContextTest.java:
+	Added implementation of setUp() and tearDown() methods, added one test.
+
 2014-05-16  Pavel Tisnovsky  <ptisnovs@redhat.com>
 
 	* src/org/RhinoTests/ScriptContextTest.java:
--- a/src/org/RhinoTests/SimpleScriptContextTest.java	Fri May 16 09:21:05 2014 +0200
+++ b/src/org/RhinoTests/SimpleScriptContextTest.java	Fri May 16 09:33:09 2014 +0200
@@ -1,7 +1,7 @@
 /*
   Rhino test framework
 
-   Copyright (C) 2011  Red Hat
+   Copyright (C) 2011, 2012, 2013, 2014  Red Hat
 
 This file is part of IcedTea.
 
@@ -40,18 +40,51 @@
 
 package org.RhinoTests;
 
+import javax.script.ScriptContext;
+import javax.script.SimpleScriptContext;
+
 /**
- * TODO: not implemented
- * @author ptisnovs
+ * Basic ScriptContext test suite. Following tests checks the interface
+ * javax.script.SimpleScriptContext.
  *
+ * @author Pavel Tisnovsky
  */
-public class SimpleScriptContextTest {
+public class SimpleScriptContextTest extends BaseRhinoTest {
+
+    @Override
+    protected void setUp(String[] args) {
+        // this block could be empty
+        return;
+    }
+
+    @Override
+    protected void tearDown() {
+        // this block could be empty
+        return;
+    }
+
+    /**
+     * Test for toString() method.
+     */
+    protected void testToString() {
+        // tested object
+        Object object = new SimpleScriptContext();
+
+        // call the toString() method
+        String string = object.toString();
+
+        assertTrue(string != null, "toString() method returned null!");
+        assertTrue(string.startsWith("javax.script.SimpleScriptContext"), "bad toString() return value " + string);
+    }
+
     /**
      * Entry point to this test case.
      *
      * @param args parameters passed from command line
      */
     public static void main(String[] args) {
+        new SimpleScriptContextTest().doTests(args);
     }
 
 }
+