/hg/rhino-tests: Added new target for report generator.

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Mon Sep 23 01:34:03 PDT 2013


changeset 187af2160af7 in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=187af2160af7
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Mon Sep 23 10:37:44 2013 +0200

	Added new target for report generator.
	Added new test testNewInstance into the test suite
	InvocableClassTest.


diffstat:

 ChangeLog                                           |   8 ++++++++
 src/org/RhinoTests/InvocableClassTest.java          |  17 +++++++++++++++++
 src/org/RhinoTests/Reporter/IndexPageGenerator.java |  11 +++++++++++
 3 files changed, 36 insertions(+), 0 deletions(-)

diffs (70 lines):

diff -r 361269035966 -r 187af2160af7 ChangeLog
--- a/ChangeLog	Fri Sep 20 11:15:56 2013 +0200
+++ b/ChangeLog	Mon Sep 23 10:37:44 2013 +0200
@@ -1,3 +1,11 @@
+2013-09-23  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/RhinoTests/InvocableClassTest.java:
+	Added new test testNewInstance into the test suite
+	InvocableClassTest.
+	* src/org/RhinoTests/Reporter/IndexPageGenerator.java:
+	Added new target for report generator.
+
 2013-09-20  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/RhinoTests/CompiledScriptClassTest.java:
diff -r 361269035966 -r 187af2160af7 src/org/RhinoTests/InvocableClassTest.java
--- a/src/org/RhinoTests/InvocableClassTest.java	Fri Sep 20 11:15:56 2013 +0200
+++ b/src/org/RhinoTests/InvocableClassTest.java	Mon Sep 23 10:37:44 2013 +0200
@@ -1420,6 +1420,23 @@
     }
 
     /**
+     * Test for method javax.script.Invocable.getClass().newInstance()
+     */
+    protected void testNewInstance() {
+        try {
+            Object o = this.invocableClass.newInstance();
+            throw new AssertionError("Class.newInstance() does not throw any exception");
+        }
+        catch (InstantiationException e) {
+            // expected exception
+        }
+        catch (IllegalAccessException e) {
+            // expected exception
+        }
+
+    }
+
+    /**
      * Test for instanceof operator applied to a class javax.script.Invocable
      */
     @SuppressWarnings("cast")
diff -r 361269035966 -r 187af2160af7 src/org/RhinoTests/Reporter/IndexPageGenerator.java
--- a/src/org/RhinoTests/Reporter/IndexPageGenerator.java	Fri Sep 20 11:15:56 2013 +0200
+++ b/src/org/RhinoTests/Reporter/IndexPageGenerator.java	Mon Sep 23 10:37:44 2013 +0200
@@ -64,6 +64,7 @@
         TestResult testResult = TestResult.readSummary(testResultForDate);
         testResult.setDate(date);
         createIndexPageFromTemplate(testResult, params);
+        createStubPageFromTemplate(testResult, params);
     }
 
     private static void createIndexPageFromTemplate(TestResult testResult, CommandLineParameters params) {
@@ -78,6 +79,16 @@
         FileUtils.writeTextFile(params.getReportDir() + "/index.html", out);
     }
 
+    private static void createStubPageFromTemplate(TestResult testResult, CommandLineParameters params) {
+        List<String> out = new LinkedList<String>();
+        out.add(testResult.getDate());
+        out.add("" + testResult.getPassed());
+        out.add("" + testResult.getFailed());
+        out.add("" + testResult.getError());
+        // write list of string to a file with given name
+        FileUtils.writeTextFile(params.getReportDir() + "/result.txt", out);
+    }
+
 	private static String replacePlaceholder(TestResult testResult, Pattern pattern, String templateLine) {
 		Matcher matcher = pattern.matcher(templateLine);
 		// if some pattern ${PLACEHOLDER} is found on the template line,


More information about the distro-pkg-dev mailing list