jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1136148 - /incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/resultset/TestResultSetFormat.java
Date Wed, 15 Jun 2011 18:54:04 GMT
Author: andy
Date: Wed Jun 15 18:54:04 2011
New Revision: 1136148

URL: http://svn.apache.org/viewvc?rev=1136148&view=rev
Log:
parameterize tests - add test

Modified:
    incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/resultset/TestResultSetFormat.java

Modified: incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/resultset/TestResultSetFormat.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/resultset/TestResultSetFormat.java?rev=1136148&r1=1136147&r2=1136148&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/resultset/TestResultSetFormat.java
(original)
+++ incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/resultset/TestResultSetFormat.java
Wed Jun 15 18:54:04 2011
@@ -1,5 +1,6 @@
 /*
  * (c) Copyright 2009 Talis Systems Ltd
+ * (c) Copyright 2011 Epimorphics Ltd.
  * All rights reserved.
  * [See end of file]
  */
@@ -8,9 +9,13 @@ package com.hp.hpl.jena.sparql.resultset
 
 import java.io.ByteArrayInputStream ;
 import java.io.ByteArrayOutputStream ;
+import java.util.Arrays ;
+import java.util.Collection ;
 
-import junit.framework.JUnit4TestAdapter ;
 import org.junit.Test ;
+import org.junit.runner.RunWith ;
+import org.junit.runners.Parameterized ;
+import org.junit.runners.Parameterized.Parameters ;
 import org.openjena.atlas.lib.StrUtils ;
 
 import com.hp.hpl.jena.query.ResultSet ;
@@ -20,28 +25,42 @@ import com.hp.hpl.jena.sparql.sse.Item ;
 import com.hp.hpl.jena.sparql.sse.SSE ;
 import com.hp.hpl.jena.sparql.sse.builders.BuilderResultSet ;
 
-
+@RunWith(Parameterized.class)
 public class TestResultSetFormat
 {
-    public static junit.framework.Test suite()
-    {
-        return new JUnit4TestAdapter(TestResultSetFormat.class) ;
-    }
-    
 
     static String[] $rs1 = {
         "(resultset (?a ?b ?c)",
-        "  (row (?a 1) (?b 2))",
+        "  (row (?a 1) (?b 2)       )",
         "  (row (?a 1) (?b 4) (?c 3))",
         ")"} ;
 
     static String[] $rs2 = {
         "(resultset (?a ?b ?c)",
         "  (row (?a 1) (?b 4) (?c 3))",
-        "  (row (?a 1) (?b 2))",
+        "  (row (?a 1) (?b 2)       )",
+        ")"} ;
+
+    static String[] $rs3 = {
+        "(resultset (?a ?b ?c)", 
+        "  (row (?a 1)        (?c 4))",
+        "  (row (?a 1) (?b 2) (?c 3))",
         ")"} ;
 
     
+    @Parameters
+    public static Collection<Object[]> data()
+    {
+        return Arrays.asList(new Object[][] { {$rs1}, {$rs2}, {$rs3} } ) ;
+    }
+
+    private final String[] $rs ;
+    
+    public TestResultSetFormat(String[] rs)
+    {
+        this.$rs = rs ;
+    }
+    
     static ResultSet make(String... strings)
     {
         if ( strings.length == 0 )
@@ -52,17 +71,15 @@ public class TestResultSetFormat
         return BuilderResultSet.build(item) ;
     }
     
-    //@Test equality tests. 
-    
     @Test public void resultset_01()           
     {
-        ResultSet rs = make($rs1) ; 
+        ResultSet rs = make($rs) ; 
         ResultSetFormatter.asText(rs) ;
     }
     
     @Test public void resultset_02()           
     {
-        ResultSet rs = make($rs1) ; 
+        ResultSet rs = make($rs) ; 
         ByteArrayOutputStream out = new ByteArrayOutputStream() ;
         ResultSetFormatter.outputAsXML(out, rs) ;
         ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()) ;
@@ -71,7 +88,7 @@ public class TestResultSetFormat
 
     @Test public void resultset_03()           
     {
-        ResultSet rs = make($rs1) ; 
+        ResultSet rs = make($rs) ; 
         ByteArrayOutputStream out = new ByteArrayOutputStream() ;
         ResultSetFormatter.outputAsJSON(out, rs) ;
         ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()) ;
@@ -80,17 +97,25 @@ public class TestResultSetFormat
     
     @Test public void resultset_04()           
     {
-        ResultSet rs = make($rs1) ; 
+        ResultSet rs = make($rs) ; 
         ByteArrayOutputStream out = new ByteArrayOutputStream() ;
         ResultSetFormatter.outputAsTSV(out, rs) ;
         ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()) ;
         ResultSet rs2 = ResultSetFactory.fromTSV(in) ;
     }
-    
+
+    @Test public void resultset_05()           
+    {
+        ResultSet rs = make($rs) ; 
+        ByteArrayOutputStream out = new ByteArrayOutputStream() ;
+        ResultSetFormatter.outputAsCSV(out, rs) ;
+    }
+
 }
 
 /*
  * (c) Copyright 2009 Talis Systems Ltd
+ * (c) Copyright 2011 Epimorphics Ltd.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without



Mime
View raw message