You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2014/06/24 11:07:06 UTC
svn commit: r1605034 [13/16] - in /jena/trunk: jena-arq/src/main/java/arq/
jena-arq/src/main/java/arq/cmdline/
jena-arq/src/main/java/com/hp/hpl/jena/query/
jena-arq/src/main/java/com/hp/hpl/jena/sparql/
jena-arq/src/main/java/com/hp/hpl/jena/sparql/al...
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestNode.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestNode.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestNode.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestNode.java Tue Jun 24 09:06:50 2014
@@ -149,15 +149,13 @@ public class TestNode extends GraphTestB
public void testNodeEquals()
{
Object [][] tests = eqTestCases();
- for (int i = 0; i < tests.length; i += 1)
+ for ( Object[] I : tests )
{
- Object [] I = tests[i];
- assertFalse( I[0] + " should not equal null", I[0].equals( null ) );
- assertFalse( I[0] + "should not equal 'String'", I[0].equals( "String" ) );
- for (int j = 0; j < tests.length; j += 1)
+ assertFalse( I[0] + " should not equal null", I[0].equals( null ) );
+ assertFalse( I[0] + "should not equal 'String'", I[0].equals( "String" ) );
+ for ( Object[] J : tests )
{
- Object [] J = tests[j];
- testEquality( I[1].equals( J[1] ), I[0], J[0] );
+ testEquality( I[1].equals( J[1] ), I[0], J[0] );
}
}
}
@@ -669,13 +667,12 @@ public class TestNode extends GraphTestB
*/
public void testNamespace()
{
- for (int i = 0; i < someURIs.length; i += 1)
+ for ( String uri : someURIs )
{
- String uri = someURIs[i];
- int split = Util.splitNamespace( uri );
- Node n = NodeCreateUtils.create( uri );
- assertEquals( "check namespace", uri.substring( 0, split ), n.getNameSpace() );
- assertEquals( "check localname", uri.substring( split ), n.getLocalName() );
+ int split = Util.splitNamespace( uri );
+ Node n = NodeCreateUtils.create( uri );
+ assertEquals( "check namespace", uri.substring( 0, split ), n.getNameSpace() );
+ assertEquals( "check localname", uri.substring( split ), n.getLocalName() );
}
}
@@ -690,8 +687,14 @@ public class TestNode extends GraphTestB
public void testHasURI()
{
- for (int i = 0; i < someURIs.length; i += 1) testHasURI( someURIs[i] );
- for (int i = 0; i < someNodes.length; i += 1) testHasURI( someNodes[i] );
+ for ( String someURI : someURIs )
+ {
+ testHasURI( someURI );
+ }
+ for ( String someNode : someNodes )
+ {
+ testHasURI( someNode );
+ }
}
protected void testHasURI( String uri )
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestNodeToTriplesMap.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestNodeToTriplesMap.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestNodeToTriplesMap.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestNodeToTriplesMap.java Tue Jun 24 09:06:50 2014
@@ -211,12 +211,15 @@ public class TestNodeToTriplesMap extend
protected void addTriples( NodeToTriplesMap nt, String facts )
{
Triple [] t = tripleArray( facts );
- for (int i = 0; i < t.length; i += 1) nt.add( t[i] );
+ for ( Triple aT : t )
+ {
+ nt.add( aT );
+ }
}
protected static <T> Set<T> just( T x )
{
- Set<T> result = new HashSet<T>();
+ Set<T> result = new HashSet<>();
result.add( x );
return result;
}
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestReifier.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestReifier.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestReifier.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestReifier.java Tue Jun 24 09:06:50 2014
@@ -57,9 +57,9 @@ public class TestReifier extends Abstrac
try
{
Constructor<?> cons = getConstructor( graphClass, new Class[] {} );
- if (cons != null) return (Graph) cons.newInstance( new Object[] { } );
+ if (cons != null) return (Graph) cons.newInstance();
Constructor<?> cons2 = getConstructor( graphClass, new Class [] {this.getClass()} );
- if (cons2 != null) return (Graph) cons2.newInstance( new Object[] { this } );
+ if (cons2 != null) return (Graph) cons2.newInstance( this );
throw new JenaException( "no suitable graph constructor found for " + graphClass );
}
catch (RuntimeException e)
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestTriple.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestTriple.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestTriple.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestTriple.java Tue Jun 24 09:06:50 2014
@@ -238,7 +238,7 @@ public class TestTriple extends GraphTes
public void testTripleToStringOrdering()
{
Triple t1 = NodeCreateUtils.createTriple( "subject predicate object" );
- assertTrue( "subject must be present", t1.toString().indexOf( "subject" ) >= 0 );
+ assertTrue( "subject must be present", t1.toString().contains( "subject" ) );
assertTrue( "subject must preceed predicate", t1.toString().indexOf( "subject" ) < t1.toString().indexOf( "predicate" ) );
assertTrue( "predicate must preceed object", t1.toString().indexOf( "predicate" ) < t1.toString().indexOf( "object" ) );
}
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestTypedLiterals.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestTypedLiterals.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestTypedLiterals.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/graph/test/TestTypedLiterals.java Tue Jun 24 09:06:50 2014
@@ -182,12 +182,12 @@ public class TestTypedLiterals extends T
// Check the numeric restriction
RDFDatatype over12Type = tm.getSafeTypeByName(uri + "#over12");
- checkLegalLiteral("15", over12Type, Integer.class, new Integer(15));
+ checkLegalLiteral("15", over12Type, Integer.class, 15 );
checkIllegalLiteral("12", over12Type);
// Check the union type
RDFDatatype clothingsize = tm.getSafeTypeByName(uri + "#clothingsize");
- checkLegalLiteral("42", clothingsize, Integer.class, new Integer(42));
+ checkLegalLiteral("42", clothingsize, Integer.class, 42 );
checkLegalLiteral("short", clothingsize, String.class, "short");
// Check use of isValidLiteral for base versus derived combinations
@@ -267,66 +267,66 @@ public class TestTypedLiterals extends T
assertSameValueAs("equality fn", l1, l3);
// Minimal check on long, short, byte
- checkLegalLiteral("12345", XSDDatatype.XSDlong, Integer.class, new Integer(12345));
- checkLegalLiteral("-12345", XSDDatatype.XSDlong, Integer.class, new Integer(-12345));
+ checkLegalLiteral("12345", XSDDatatype.XSDlong, Integer.class, 12345 );
+ checkLegalLiteral("-12345", XSDDatatype.XSDlong, Integer.class, -12345 );
checkIllegalLiteral("2.3", XSDDatatype.XSDlong);
- checkLegalLiteral("1234", XSDDatatype.XSDshort, Integer.class, new Integer((short)1234));
- checkLegalLiteral("-1234", XSDDatatype.XSDshort, Integer.class, new Integer((short)-1234));
- checkLegalLiteral("32767", XSDDatatype.XSDshort, Integer.class, new Integer((short)32767));
- checkLegalLiteral("-32768", XSDDatatype.XSDshort, Integer.class, new Integer((short)-32768));
+ checkLegalLiteral("1234", XSDDatatype.XSDshort, Integer.class, (int) (short) 1234 );
+ checkLegalLiteral("-1234", XSDDatatype.XSDshort, Integer.class, (int) (short) -1234 );
+ checkLegalLiteral("32767", XSDDatatype.XSDshort, Integer.class, (int) (short) 32767 );
+ checkLegalLiteral("-32768", XSDDatatype.XSDshort, Integer.class, (int) (short) -32768 );
checkIllegalLiteral("32769", XSDDatatype.XSDshort);
checkIllegalLiteral("2.3", XSDDatatype.XSDshort);
- checkLegalLiteral("42", XSDDatatype.XSDbyte, Integer.class, new Integer((byte)42));
- checkLegalLiteral("-42", XSDDatatype.XSDbyte, Integer.class, new Integer((byte)-42));
- checkLegalLiteral("127", XSDDatatype.XSDbyte, Integer.class, new Integer((byte)127));
- checkLegalLiteral("-128", XSDDatatype.XSDbyte, Integer.class, new Integer((byte)-128));
+ checkLegalLiteral("42", XSDDatatype.XSDbyte, Integer.class, (int) (byte) 42 );
+ checkLegalLiteral("-42", XSDDatatype.XSDbyte, Integer.class, (int) (byte) -42 );
+ checkLegalLiteral("127", XSDDatatype.XSDbyte, Integer.class, (int) (byte) 127 );
+ checkLegalLiteral("-128", XSDDatatype.XSDbyte, Integer.class, (int) (byte) -128 );
checkIllegalLiteral("32769", XSDDatatype.XSDbyte);
checkIllegalLiteral("128", XSDDatatype.XSDbyte);
checkIllegalLiteral("2.3", XSDDatatype.XSDbyte);
// Minimal check on unsigned normal types
- checkLegalLiteral("12345", XSDDatatype.XSDunsignedLong, Integer.class, new Integer(12345));
- checkLegalLiteral("+12345", XSDDatatype.XSDunsignedLong, Integer.class, new Integer(12345));
+ checkLegalLiteral("12345", XSDDatatype.XSDunsignedLong, Integer.class, 12345 );
+ checkLegalLiteral("+12345", XSDDatatype.XSDunsignedLong, Integer.class, 12345 );
checkLegalLiteral("9223372036854775808", XSDDatatype.XSDunsignedLong, BigInteger.class, new BigInteger("9223372036854775808"));
checkIllegalLiteral("-12345", XSDDatatype.XSDunsignedLong);
- checkLegalLiteral("12345", XSDDatatype.XSDunsignedInt, Integer.class, new Integer(12345));
- checkLegalLiteral("2147483648", XSDDatatype.XSDunsignedInt, Long.class, new Long(2147483648l));
+ checkLegalLiteral("12345", XSDDatatype.XSDunsignedInt, Integer.class, 12345 );
+ checkLegalLiteral("2147483648", XSDDatatype.XSDunsignedInt, Long.class, 2147483648l );
checkIllegalLiteral("-12345", XSDDatatype.XSDunsignedInt);
- checkLegalLiteral("1234", XSDDatatype.XSDunsignedShort, Integer.class, new Integer(1234));
- checkLegalLiteral("32679", XSDDatatype.XSDunsignedShort, Integer.class, new Integer(32679));
+ checkLegalLiteral("1234", XSDDatatype.XSDunsignedShort, Integer.class, 1234 );
+ checkLegalLiteral("32679", XSDDatatype.XSDunsignedShort, Integer.class, 32679 );
checkIllegalLiteral("-12345", XSDDatatype.XSDunsignedShort);
- checkLegalLiteral("123", XSDDatatype.XSDunsignedByte, Integer.class, new Integer((short)123));
- checkLegalLiteral("129", XSDDatatype.XSDunsignedByte, Integer.class, new Integer((short)129));
+ checkLegalLiteral("123", XSDDatatype.XSDunsignedByte, Integer.class, (int) (short) 123 );
+ checkLegalLiteral("129", XSDDatatype.XSDunsignedByte, Integer.class, (int) (short) 129 );
checkIllegalLiteral("-123", XSDDatatype.XSDunsignedByte);
// Minimal check on the big num types
- checkLegalLiteral("12345", XSDDatatype.XSDinteger, Integer.class, new Integer(12345));
- checkLegalLiteral("0", XSDDatatype.XSDinteger, Integer.class, new Integer(0));
- checkLegalLiteral("-12345", XSDDatatype.XSDinteger, Integer.class, new Integer(-12345));
+ checkLegalLiteral("12345", XSDDatatype.XSDinteger, Integer.class, 12345 );
+ checkLegalLiteral("0", XSDDatatype.XSDinteger, Integer.class, 0 );
+ checkLegalLiteral("-12345", XSDDatatype.XSDinteger, Integer.class, -12345 );
checkLegalLiteral("9223372036854775808", XSDDatatype.XSDinteger, BigInteger.class, new BigInteger("9223372036854775808"));
- checkLegalLiteral("12345", XSDDatatype.XSDpositiveInteger, Integer.class, new Integer(12345));
+ checkLegalLiteral("12345", XSDDatatype.XSDpositiveInteger, Integer.class, 12345 );
checkIllegalLiteral("0", XSDDatatype.XSDpositiveInteger);
checkIllegalLiteral("-12345", XSDDatatype.XSDpositiveInteger);
checkLegalLiteral("9223372036854775808", XSDDatatype.XSDpositiveInteger, BigInteger.class, new BigInteger("9223372036854775808"));
- checkLegalLiteral("12345", XSDDatatype.XSDnonNegativeInteger, Integer.class, new Integer(12345));
- checkLegalLiteral("0", XSDDatatype.XSDnonNegativeInteger, Integer.class, new Integer(0));
+ checkLegalLiteral("12345", XSDDatatype.XSDnonNegativeInteger, Integer.class, 12345 );
+ checkLegalLiteral("0", XSDDatatype.XSDnonNegativeInteger, Integer.class, 0 );
checkIllegalLiteral("-12345", XSDDatatype.XSDnonNegativeInteger);
checkLegalLiteral("9223372036854775808", XSDDatatype.XSDnonNegativeInteger, BigInteger.class, new BigInteger("9223372036854775808"));
- checkLegalLiteral("-12345", XSDDatatype.XSDnegativeInteger, Integer.class, new Integer(-12345));
+ checkLegalLiteral("-12345", XSDDatatype.XSDnegativeInteger, Integer.class, -12345 );
checkIllegalLiteral("0", XSDDatatype.XSDnegativeInteger);
checkIllegalLiteral("12345", XSDDatatype.XSDnegativeInteger);
checkLegalLiteral("-9223372036854775808", XSDDatatype.XSDnegativeInteger, BigInteger.class, new BigInteger("-9223372036854775808"));
- checkLegalLiteral("-12345", XSDDatatype.XSDnonPositiveInteger, Integer.class, new Integer(-12345));
- checkLegalLiteral("0", XSDDatatype.XSDnonPositiveInteger, Integer.class, new Integer(0));
+ checkLegalLiteral("-12345", XSDDatatype.XSDnonPositiveInteger, Integer.class, -12345 );
+ checkLegalLiteral("0", XSDDatatype.XSDnonPositiveInteger, Integer.class, 0 );
checkIllegalLiteral("12345", XSDDatatype.XSDnonPositiveInteger);
checkLegalLiteral("-9223372036854775808", XSDDatatype.XSDnonPositiveInteger, BigInteger.class, new BigInteger("-9223372036854775808"));
@@ -338,8 +338,8 @@ public class TestTypedLiterals extends T
checkIllegalLiteral("123,4", XSDDatatype.XSDdecimal);
// Booleans
- checkLegalLiteral("true", XSDDatatype.XSDboolean, Boolean.class, new Boolean(true));
- checkLegalLiteral("false", XSDDatatype.XSDboolean, Boolean.class, new Boolean(false));
+ checkLegalLiteral("true", XSDDatatype.XSDboolean, Boolean.class, true );
+ checkLegalLiteral("false", XSDDatatype.XSDboolean, Boolean.class, false );
l1 = m.createTypedLiteral(true);
assertEquals("boolean mapping", XSDDatatype.XSDboolean, l1.getDatatype());
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/mem/test/TestHashCommon.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/mem/test/TestHashCommon.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/mem/test/TestHashCommon.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/mem/test/TestHashCommon.java Tue Jun 24 09:06:50 2014
@@ -163,7 +163,7 @@ public class TestHashCommon extends Mode
protected Set<Item> itemSet( String items )
{
- Set<Item> result = new HashSet<Item>();
+ Set<Item> result = new HashSet<>();
StringTokenizer st = new StringTokenizer( items );
while (st.hasMoreTokens()) addItem( result, st.nextToken() );
return result;
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/mem/test/TestTripleBunch.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/mem/test/TestTripleBunch.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/mem/test/TestTripleBunch.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/mem/test/TestTripleBunch.java Tue Jun 24 09:06:50 2014
@@ -136,7 +136,7 @@ public abstract class TestTripleBunch ex
protected List<Triple> listOf( Triple x )
{
- List<Triple> result = new ArrayList<Triple>();
+ List<Triple> result = new ArrayList<>();
result.add( x );
return result;
}
@@ -150,7 +150,7 @@ public abstract class TestTripleBunch ex
protected Set<Triple> setOf( Triple x )
{
- Set<Triple> result = new HashSet<Triple>();
+ Set<Triple> result = new HashSet<>();
result.add( x );
return result;
}
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/n3/N3ExternalTestsCom.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/n3/N3ExternalTestsCom.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/n3/N3ExternalTestsCom.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/n3/N3ExternalTestsCom.java Tue Jun 24 09:06:50 2014
@@ -73,16 +73,16 @@ public abstract class N3ExternalTestsCom
protected String findFile(String fname)
{
- for ( int i = 0 ; i < dirbases.length ; i++ )
- {
- String maybeFile = dirbases[i]+"/"+fname ;
- File f = new File(maybeFile) ;
- if ( f.exists() )
- {
- basedir = dirbases[i] ;
- return f.getAbsolutePath() ;
- }
- }
+ for ( String dirbase : dirbases )
+ {
+ String maybeFile = dirbase + "/" + fname;
+ File f = new File( maybeFile );
+ if ( f.exists() )
+ {
+ basedir = dirbase;
+ return f.getAbsolutePath();
+ }
+ }
return null ;
}
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/n3/TupleSet.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/n3/TupleSet.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/n3/TupleSet.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/n3/TupleSet.java Tue Jun 24 09:06:50 2014
@@ -90,7 +90,7 @@ class TupleSet implements Iterator<List<
}
//System.out.println("Line: "+line) ;
- List<TupleItem> tuple = new ArrayList<TupleItem>() ;
+ List<TupleItem> tuple = new ArrayList<>() ;
int i = 0 ;
int j = 0 ;
boolean errorFound = false ;
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/OntTestBase.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/OntTestBase.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/OntTestBase.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/OntTestBase.java Tue Jun 24 09:06:50 2014
@@ -61,8 +61,9 @@ public abstract class OntTestBase
super( name );
TestCase[] tc = getTests();
- for (int i = 0; i < tc.length; i++) {
- addTest( tc[i] );
+ for ( TestCase aTc : tc )
+ {
+ addTest( aTc );
}
}
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/TestCreate.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/TestCreate.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/TestCreate.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/TestCreate.java Tue Jun 24 09:06:50 2014
@@ -382,8 +382,9 @@ public class TestCreate
public static TestSuite suite() {
TestSuite s = new TestSuite( "TestCreate" );
- for (int i = 0; i < testCases.length; i++) {
- s.addTest( testCases[i] );
+ for ( CreateTestCase testCase : testCases )
+ {
+ s.addTest( testCase );
}
return s;
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/TestListSyntaxCategories.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/TestListSyntaxCategories.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/TestListSyntaxCategories.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/TestListSyntaxCategories.java Tue Jun 24 09:06:50 2014
@@ -665,8 +665,9 @@ public class TestListSyntaxCategories
public static TestSuite suite() {
TestSuite s = new TestSuite( "TestListSyntaxCategories" );
- for (int i = 0; i < testCases.length; i++) {
- s.addTest( testCases[i] );
+ for ( DoListTest testCase : testCases )
+ {
+ s.addTest( testCase );
}
return s;
@@ -735,7 +736,7 @@ public class TestListSyntaxCategories
if (!exOccurred) {
List<Resource> expected = expected( m );
- List<Resource> actual = new ArrayList<Resource>();
+ List<Resource> actual = new ArrayList<>();
int extraneous = 0;
// now we walk the iterator
@@ -761,13 +762,15 @@ public class TestListSyntaxCategories
// debugging
if (m_count != actual.size()) {
logger.debug( getName() + " - expected " + m_count + " results, actual = " + actual.size() );
- for (Iterator<Resource> j = actual.iterator(); j.hasNext(); ) {
- logger.debug( getName() + " - saw actual: " + j.next() );
+ for ( Resource anActual : actual )
+ {
+ logger.debug( getName() + " - saw actual: " + anActual );
}
}
if (expected != null && !expected.isEmpty()) {
- for (Iterator<Resource> j = expected.iterator(); j.hasNext(); ) {
- logger.debug( getName() + " - expected but did not find: " + j.next() );
+ for ( Resource anExpected : expected )
+ {
+ logger.debug( getName() + " - expected but did not find: " + anExpected );
}
}
@@ -792,10 +795,11 @@ public class TestListSyntaxCategories
protected List<Resource> expected( OntModel m ) {
if (m_expected != null) {
- List<Resource> expected = new ArrayList<Resource>();
+ List<Resource> expected = new ArrayList<>();
- for (int i = 0; i < m_expected.length; i++) {
- expected.add( m.getResource( m_expected[i] ) );
+ for ( String aM_expected : m_expected )
+ {
+ expected.add( m.getResource( aM_expected ) );
}
return expected;
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/TestOntDocumentManager.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/TestOntDocumentManager.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/TestOntDocumentManager.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/TestOntDocumentManager.java Tue Jun 24 09:06:50 2014
@@ -62,7 +62,7 @@ public class TestOntDocumentManager
/** Logger for this class */
private static Logger log = LoggerFactory.getLogger( TestOntDocumentManager.class );
- public static final Integer cnt( int x ) {return new Integer(x);}
+ public static final Integer cnt( int x ) {return x;}
/* Data for various combinations of test import conditions */
public static Object[][] s_testData = new Object[][] {
@@ -94,11 +94,11 @@ public class TestOntDocumentManager
suite.addTestSuite( TestOntDocumentManager.class );
// add the data-driven test cases
- for (int i = 0; i < s_testData.length; i++) {
- suite.addTest( new DocManagerImportTest( (String) s_testData[i][0],
- ((Integer) s_testData[i][1]).intValue(),
- ((Boolean) s_testData[i][2]).booleanValue(),
- (String) s_testData[i][3]) );
+ for ( Object[] aS_testData : s_testData )
+ {
+ suite.addTest( new DocManagerImportTest( (String) aS_testData[0], ( (Integer) aS_testData[1] ).intValue(),
+ ( (Boolean) aS_testData[2] ).booleanValue(),
+ (String) aS_testData[3] ) );
}
return suite;
}
@@ -114,14 +114,14 @@ public class TestOntDocumentManager
// forget any cached models in the model spec
// TODO remove this once we rationalise modelmakers in the OntModel code
- Set<String> modelNames = new HashSet<String>();
+ Set<String> modelNames = new HashSet<>();
ModelMaker memMaker = OntModelSpec.OWL_MEM.getImportModelMaker();
for (Iterator<String> i = memMaker.listModels(); i.hasNext(); ) {
modelNames.add( i.next() );
}
- for (Iterator<String> i = modelNames.iterator(); i.hasNext(); ) {
- String mn = i.next();
+ for ( String mn : modelNames )
+ {
memMaker.removeModel( mn );
}
}
@@ -315,7 +315,7 @@ public class TestOntDocumentManager
// TODO this workaround to be removed
SimpleGraphMaker sgm = (SimpleGraphMaker) ((ModelMakerImpl) spec.getImportModelMaker()).getGraphMaker();
- List<String> toGo = new ArrayList<String>();
+ List<String> toGo = new ArrayList<>();
for (Iterator<String> i = sgm.listGraphs(); i.hasNext(); toGo.add( i.next() )) {/**/}
for (Iterator<String> i = toGo.iterator(); i.hasNext(); sgm.removeGraph( i.next() )) {/**/}
spec.getDocumentManager().clearCache();
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/TestOntModel.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/TestOntModel.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/TestOntModel.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/TestOntModel.java Tue Jun 24 09:06:50 2014
@@ -28,6 +28,7 @@ import java.util.*;
import com.hp.hpl.jena.graph.Graph;
import com.hp.hpl.jena.ontology.*;
+import com.hp.hpl.jena.ontology.impl.OWLProfile.SupportsCheck ;
import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.rdf.model.test.ModelTestBase;
import com.hp.hpl.jena.reasoner.rulesys.test.TestBugs;
@@ -493,16 +494,6 @@ public class TestOntModel
List<Graph> subs = m.getSubGraphs();
assertEquals( "n subgraphs should be ", 3, subs.size() );
-
- boolean isGraph = true;
- for (Iterator<Graph> i = subs.iterator(); i.hasNext(); ) {
- Object x = i.next();
- if (!(x instanceof Graph)) {
- isGraph = false;
- }
- }
- assertTrue( "All sub-graphs should be graphs", isGraph );
-
}
@@ -660,29 +651,20 @@ public class TestOntModel
m.read( "file:testing/ontology/testImport6/a.owl" );
assertEquals( "Marker count not correct", 4, TestOntDocumentManager.countMarkers( m ) );
- List<OntModel> importModels = new ArrayList<OntModel>();
+ List<OntModel> importModels = new ArrayList<>();
for (Iterator<OntModel> j = m.listSubModels(); j.hasNext(); ) {
importModels.add( j.next() );
}
assertEquals( "n import models should be ", 3, importModels.size() );
- boolean isOntModel = true;
int nImports = 0;
- for (Iterator<OntModel> i = importModels.iterator(); i.hasNext(); ) {
- Object x = i.next();
- if (!(x instanceof OntModel)) {
- isOntModel = false;
- }
- else {
- // count the number of imports of each sub-model
- nImports += ((OntModel) x).countSubModels();
- }
+ for ( OntModel x : importModels )
+ {
+ // count the number of imports of each sub-model
+ nImports += x.countSubModels();
}
-
- assertTrue( "All import models should be OntModels", isOntModel );
-
// listSubModels' default behaviour is *not* to include imports of sub-models
assertEquals( "Wrong number of sub-model imports", 0, nImports );
}
@@ -692,28 +674,20 @@ public class TestOntModel
m.read( "file:testing/ontology/testImport6/a.owl" );
assertEquals( "Marker count not correct", 4, TestOntDocumentManager.countMarkers( m ) );
- List<OntModel> importModels = new ArrayList<OntModel>();
+ List<OntModel> importModels = new ArrayList<>();
for (Iterator<OntModel> j = m.listSubModels( true ); j.hasNext(); ) {
importModels.add( j.next() );
}
assertEquals( "n import models should be ", 3, importModels.size() );
- boolean isOntModel = true;
int nImports = 0;
- for (Iterator<OntModel> i = importModels.iterator(); i.hasNext(); ) {
- Object x = i.next();
- if (!(x instanceof OntModel)) {
- isOntModel = false;
- }
- else {
- // count the number of imports of each sub-model
- nImports += ((OntModel) x).countSubModels();
- }
+ for ( OntModel x : importModels )
+ {
+ // count the number of imports of each sub-model
+ nImports += x.countSubModels();
}
-
- assertTrue( "All import models should be OntModels", isOntModel );
assertEquals( "Wrong number of sub-model imports", 2, nImports );
}
@@ -743,15 +717,17 @@ public class TestOntModel
List<Class<?>> notInDL = Arrays.asList( new Class<?>[] {} );
List<Class<?>> notInLite = Arrays.asList( new Class<?>[] {DataRange.class, HasValueRestriction.class} );
- Map<?,?> fullProfileMap = new OWLProfileExt().getSupportsMap();
- Map<?,?> dlProfileMap = new OWLDLProfileExt().getSupportsMap();
- Map<?,?> liteProfileMap = new OWLLiteProfileExt().getSupportsMap();
-
- for (Iterator<?> i = fullProfileMap.entrySet().iterator(); i.hasNext(); ) {
- Map.Entry<?,?> kv = (Map.Entry<?,?>) i.next();
- Class<?> c = (Class<?>) kv.getKey();
- assertTrue( "Key in OWL DL profile: " + c.getName(), dlProfileMap.containsKey( c ) || notInDL.contains( c ));
- assertTrue( "Key in OWL lite profile: " + c.getName(), liteProfileMap.containsKey( c ) || notInLite.contains( c ));
+ Map<Class<?>, SupportsCheck> fullProfileMap = new OWLProfileExt().getSupportsMap();
+ Map<Class<?>, SupportsCheck> dlProfileMap = new OWLDLProfileExt().getSupportsMap();
+ Map<Class<?>, SupportsCheck> liteProfileMap = new OWLLiteProfileExt().getSupportsMap();
+
+ for ( Map.Entry<Class<?>, SupportsCheck> entry : fullProfileMap.entrySet() )
+ {
+ Class<?> c = entry.getKey();
+ assertTrue( "Key in OWL DL profile: " + c.getName(),
+ dlProfileMap.containsKey( c ) || notInDL.contains( c ) );
+ assertTrue( "Key in OWL lite profile: " + c.getName(),
+ liteProfileMap.containsKey( c ) || notInLite.contains( c ) );
}
}
@@ -1303,21 +1279,21 @@ public class TestOntModel
protected class OWLProfileExt extends OWLProfile
{
- public Map<?,?> getSupportsMap() {
+ public Map<Class<?>, SupportsCheck> getSupportsMap() {
return getCheckTable();
}
}
protected class OWLDLProfileExt extends OWLDLProfile
{
- public Map<?,?> getSupportsMap() {
+ public Map<Class<?>, SupportsCheck> getSupportsMap() {
return getCheckTable();
}
}
protected class OWLLiteProfileExt extends OWLLiteProfile
{
- public Map<?,?> getSupportsMap() {
+ public Map<Class<?>, SupportsCheck> getSupportsMap() {
return getCheckTable();
}
}
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/TestOntReasoning.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/TestOntReasoning.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/TestOntReasoning.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/TestOntReasoning.java Tue Jun 24 09:06:50 2014
@@ -382,7 +382,7 @@ public class TestOntReasoning
OntModel m = ModelFactory.createOntologyModel(spec, aBox);
- List<Individual> inds = new ArrayList<Individual>();
+ List<Individual> inds = new ArrayList<>();
for (Iterator<Individual> i = m.listIndividuals(); i.hasNext();) {
inds.add(i.next());
}
@@ -482,9 +482,10 @@ public class TestOntReasoning
/** Test that an iterator delivers the expected values */
protected void iteratorTest( Iterator<?> i, Object[] expected ) {
Logger logger = LoggerFactory.getLogger( getClass() );
- List<Object> expList = new ArrayList<Object>();
- for (int j = 0; j < expected.length; j++) {
- expList.add( expected[j] );
+ List<Object> expList = new ArrayList<>();
+ for ( Object anExpected : expected )
+ {
+ expList.add( anExpected );
}
while (i.hasNext()) {
@@ -501,8 +502,9 @@ public class TestOntReasoning
if (!(expList.size() == 0)) {
logger.debug( getName() + " Expected iterator results not found" );
- for (Iterator<?> j = expList.iterator(); j.hasNext(); ) {
- logger.debug( getName() + " - missing: " + j.next() );
+ for ( Object anExpList : expList )
+ {
+ logger.debug( getName() + " - missing: " + anExpList );
}
}
assertEquals( "There were expected elements from the iterator that were not found", 0, expList.size() );
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/TestOntTools.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/TestOntTools.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/TestOntTools.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/ontology/impl/TestOntTools.java Tue Jun 24 09:06:50 2014
@@ -23,15 +23,20 @@ package com.hp.hpl.jena.ontology.impl;
// Imports
///////////////
-import java.util.Iterator;
-import java.util.List;
+import java.util.List ;
-import junit.framework.TestCase;
+import junit.framework.TestCase ;
-import com.hp.hpl.jena.ontology.*;
-import com.hp.hpl.jena.rdf.model.*;
-import com.hp.hpl.jena.util.iterator.Filter;
-import com.hp.hpl.jena.vocabulary.OWL;
+import com.hp.hpl.jena.ontology.OntClass ;
+import com.hp.hpl.jena.ontology.OntModel ;
+import com.hp.hpl.jena.ontology.OntModelSpec ;
+import com.hp.hpl.jena.ontology.OntTools ;
+import com.hp.hpl.jena.rdf.model.ModelFactory ;
+import com.hp.hpl.jena.rdf.model.Property ;
+import com.hp.hpl.jena.rdf.model.ResourceFactory ;
+import com.hp.hpl.jena.rdf.model.Statement ;
+import com.hp.hpl.jena.util.iterator.Filter ;
+import com.hp.hpl.jena.vocabulary.OWL ;
/**
@@ -450,9 +455,9 @@ public class TestOntTools
assertEquals( expected.length, path.size() );
int i = 0;
- Iterator<Statement> j = path.iterator();
- while (j.hasNext()) {
- assertEquals( "path position: " + i, expected[i], j.next().getPredicate() );
+ for ( Statement aPath : path )
+ {
+ assertEquals( "path position: " + i, expected[i], aPath.getPredicate() );
i++;
}
}
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/MoreTests.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/MoreTests.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/MoreTests.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/MoreTests.java Tue Jun 24 09:06:50 2014
@@ -508,9 +508,9 @@ public class MoreTests extends TestCase
try {
a.load(in);
fail("Thread was not interrupted.");
- } catch (InterruptedIOException e) {
- } catch (SAXParseException e) {
- } finally {
+ } catch (InterruptedIOException | SAXParseException e) {
+ }
+ finally {
in.close();
}
// System.err.println("Finished "+Thread.interrupted());
@@ -595,11 +595,13 @@ public class MoreTests extends TestCase
}
private void checkExpected() {
- for (int i = 0; i < expected.length; i++)
- if (expected[i] != 0) {
- fail("Expected error: " + ParseException.errorCodeName(expected[i])
- + " but it did not occur.");
- }
+ for ( int anExpected : expected )
+ {
+ if ( anExpected != 0 )
+ {
+ fail( "Expected error: " + ParseException.errorCodeName( anExpected ) + " but it did not occur." );
+ }
+ }
}
@Override
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/NTripleTestSuite.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/NTripleTestSuite.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/NTripleTestSuite.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/NTripleTestSuite.java Tue Jun 24 09:06:50 2014
@@ -17,33 +17,21 @@
*/
package com.hp.hpl.jena.rdf.arp;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.junit.Assert;
-import junit.framework.TestSuite;
-
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-import org.apache.jena.iri.IRI;
-import com.hp.hpl.jena.rdf.arp.ALiteral;
-import com.hp.hpl.jena.rdf.arp.ARPEventHandler;
-import com.hp.hpl.jena.rdf.arp.AResource;
-import com.hp.hpl.jena.rdf.arp.NTriple;
-import com.hp.hpl.jena.rdf.arp.impl.ARPResource;
-import com.hp.hpl.jena.rdf.arp.impl.ARPSaxErrorHandler;
-import com.hp.hpl.jena.rdf.model.Model;
-import com.hp.hpl.jena.rdf.model.RDFErrorHandler;
-import com.hp.hpl.jena.shared.wg.TestInputStreamFactory;
+import java.io.* ;
+import java.util.HashSet ;
+import java.util.Set ;
+
+import junit.framework.TestSuite ;
+import org.apache.jena.iri.IRI ;
+import org.junit.Assert ;
+import org.xml.sax.SAXException ;
+import org.xml.sax.SAXParseException ;
+
+import com.hp.hpl.jena.rdf.arp.impl.ARPResource ;
+import com.hp.hpl.jena.rdf.arp.impl.ARPSaxErrorHandler ;
+import com.hp.hpl.jena.rdf.model.Model ;
+import com.hp.hpl.jena.rdf.model.RDFErrorHandler ;
+import com.hp.hpl.jena.shared.wg.TestInputStreamFactory ;
/**
* A version of the test suite which uses the
@@ -88,8 +76,8 @@ class NTripleTestSuite extends WGTestSui
xCountDown = cnt;
}
final int xCountDown;
- Set<AResource> anon = new HashSet<AResource>();
- Set<AResource> oldAnon = new HashSet<AResource>();
+ Set<AResource> anon = new HashSet<>();
+ Set<AResource> oldAnon = new HashSet<>();
int state = 1; // 1 begin, 2 in RDF, 3 after RDF, 4 at end-of-file.
int countDown;
@Override
@@ -191,13 +179,12 @@ class NTripleTestSuite extends WGTestSui
*/
public void atEndOfFile() {
if (!anon.isEmpty()) {
- Iterator<AResource> it = anon.iterator();
- while (it.hasNext()) {
- AResource a =
- it.next();
- System.err.print(a.getAnonymousID() + ", ");
- if (ARPResource.DEBUG) {
- RuntimeException rte = (RuntimeException)a.getUserData();
+ for ( AResource a : anon )
+ {
+ System.err.print( a.getAnonymousID() + ", " );
+ if ( ARPResource.DEBUG )
+ {
+ RuntimeException rte = (RuntimeException) a.getUserData();
// throw rte;
rte.printStackTrace();
}
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/Performance.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/Performance.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/Performance.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/Performance.java Tue Jun 24 09:06:50 2014
@@ -609,8 +609,10 @@ class Performance {
int r = 0;
if (array == null)
return 0;
- for (int i = 0; i < array.length; i++)
- r += array[i];
+ for ( byte anArray : array )
+ {
+ r += anArray;
+ }
return r;
}
static double speed() {
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/SAX2RDFTest.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/SAX2RDFTest.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/SAX2RDFTest.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/SAX2RDFTest.java Tue Jun 24 09:06:50 2014
@@ -1123,7 +1123,7 @@ public class SAX2RDFTest extends TestCas
static class RDFEHArray implements RDFErrorHandler {
- Vector<String> v = new Vector<String>();
+ Vector<String> v = new Vector<>();
/*
* (non-Javadoc)
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/TaintingTests.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/TaintingTests.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/TaintingTests.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/TaintingTests.java Tue Jun 24 09:06:50 2014
@@ -140,8 +140,10 @@ public class TaintingTests extends TestC
static public Test suite() {
TestSuite suite = new TestSuite("ARP Tainting");
- for (int i=0;i<files.length;i++)
- suite.addTest(new TaintingTests(files[i]));
+ for ( String file : files )
+ {
+ suite.addTest( new TaintingTests( file ) );
+ }
suite.addTest(new TaintingTests("testing/arp/tainting/base.rdf",
badBase,
"testing/arp/tainting/base-with-bad-base-good.nt",
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/TestPropEltErrorMsg.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/TestPropEltErrorMsg.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/TestPropEltErrorMsg.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/TestPropEltErrorMsg.java Tue Jun 24 09:06:50 2014
@@ -320,7 +320,7 @@ public class TestPropEltErrorMsg extends
}
static private class Atts implements Attributes {
- ArrayList<Att> atts = new ArrayList<Att>();
+ ArrayList<Att> atts = new ArrayList<>();
@Override
public int getLength() {
return atts.size();
@@ -402,7 +402,7 @@ public class TestPropEltErrorMsg extends
s.setName("ARP Property Element Error Messages");
for (int i=1;i<128;i++) {
Atts atts = new Atts();
- StringBuffer name = new StringBuffer();
+ StringBuilder name = new StringBuilder();
switch(i&3) {
case 0:
break;
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/WGTestSuite.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/WGTestSuite.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/WGTestSuite.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/WGTestSuite.java Tue Jun 24 09:06:50 2014
@@ -121,8 +121,8 @@ class WGTestSuite extends TestSuite impl
jr.setErrorHandler(eh);
jr.setProperty("error-mode", "strict");
- if ( base.indexOf("/xmlns/") != -1
- || base.indexOf("/comments/") != -1 )
+ if ( base.contains( "/xmlns/" )
+ || base.contains( "/comments/" ) )
jr.setProperty("embedding","true");
InputStream inx = in.open();
jr.read(model, inx, base);
@@ -202,7 +202,7 @@ class WGTestSuite extends TestSuite impl
Arrays.asList(
new String[] { "http://www.w3.org/2000/10/rdf-tests/rdfcore/rdfms-uri-substructure/error001" });
- private Map<ResourceImpl, Act> behaviours = new HashMap<ResourceImpl, Act>();
+ private Map<ResourceImpl, Act> behaviours = new HashMap<>();
{
behaviours
@@ -359,7 +359,7 @@ class WGTestSuite extends TestSuite impl
true);
}
- private Map<String, TestSuite> parts = new HashMap<String, TestSuite>();
+ private Map<String, TestSuite> parts = new HashMap<>();
private void addTest(Resource key, TestCase test) {
String keyName =
@@ -502,8 +502,8 @@ class WGTestSuite extends TestSuite impl
int eCode = ((ParseException) e).getErrorNumber();
if (eCode == ERR_SYNTAX_ERROR) {
String msg = e.getMessage();
- if (msg.indexOf("Unusual") != -1
- || msg.indexOf("Internal") != -1) {
+ if ( msg.contains( "Unusual" )
+ || msg.contains( "Internal" ) ) {
System.err.println(testID.getURI());
System.err.println(msg);
fail(msg);
@@ -565,7 +565,7 @@ class WGTestSuite extends TestSuite impl
}
@Override
void initExpected() {
- expected = new HashSet<Integer>();
+ expected = new HashSet<>();
}
}
@@ -594,7 +594,7 @@ class WGTestSuite extends TestSuite impl
Model m1;
Set<Integer> expected;
int expectedLevel = 1;
- private Set<Integer> found = new HashSet<Integer>();
+ private Set<Integer> found = new HashSet<>();
private int errorCnt[] = new int[] { 0, 0, 0 };
String createExpected() {
String rslt = "new int[]{";
@@ -631,7 +631,7 @@ class WGTestSuite extends TestSuite impl
void initExpectedFromModel() {
StmtIterator si = testID.listProperties(errorCodes);
if (si.hasNext()) {
- expected = new HashSet<Integer>();
+ expected = new HashSet<>();
while (si.hasNext()) {
String uri = si.nextStatement().getResource().getURI();
String fieldName = uri.substring(uri.lastIndexOf('#') + 1);
@@ -662,7 +662,7 @@ class WGTestSuite extends TestSuite impl
fail(ioe.getMessage());
}
if (expected != null && !expected.equals(found)) {
- Set<Integer> dup = new HashSet<Integer>();
+ Set<Integer> dup = new HashSet<>();
dup.addAll(found);
dup.removeAll(expected);
expected.removeAll(found);
@@ -783,8 +783,8 @@ class WGTestSuite extends TestSuite impl
int eCode = ((ParseException) e).getErrorNumber();
if (eCode == ERR_SYNTAX_ERROR) {
String msg = e.getMessage();
- if (msg.indexOf("Unusual") != -1
- || msg.indexOf("Internal") != -1) {
+ if ( msg.contains( "Unusual" )
+ || msg.contains( "Internal" ) ) {
System.err.println(getName());
System.err.println(msg);
fail(msg);
@@ -867,7 +867,7 @@ class WGTestSuite extends TestSuite impl
}
}
void initExpected() {
- expected = new HashSet<Integer>();
+ expected = new HashSet<>();
}
}
@@ -890,7 +890,7 @@ class WGTestSuite extends TestSuite impl
int expectedLevel = 1;
String in;
boolean intype;
- private Set<Integer> found = new HashSet<Integer>();
+ private Set<Integer> found = new HashSet<>();
private int errorCnt[] = new int[] { 0, 0, 0 };
NegativeTest2(String uri, String in, boolean intype, int errs[]) {
super(uri);
@@ -920,10 +920,11 @@ class WGTestSuite extends TestSuite impl
if ( errs == null )
return;
if (errs.length != 0)
- expected = new HashSet<Integer>();
- for (int i = 0; i < errs.length; i++) {
+ expected = new HashSet<>();
+ for ( int err : errs )
+ {
- expected.add(new Integer(errs[i]));
+ expected.add( new Integer( err ) );
}
}
@Override
@@ -948,15 +949,15 @@ class WGTestSuite extends TestSuite impl
fail(ioe.getMessage());
}
// Tidy up this code a bit, I don't understand it.
- HashSet<Integer> ex2 = expected==null?null:new HashSet<Integer>(expected);
+ HashSet<Integer> ex2 = expected==null?null:new HashSet<>(expected);
if (expected==null)
for (int j = 2; j >= 0; j--)
if (j != expectedLevel) {
if (errorCnt[j] != 0)
- ex2 = new HashSet<Integer>();
+ ex2 = new HashSet<>();
}
if (ex2 != null && !ex2.equals(found)) {
- Set<Integer> dup = new HashSet<Integer>();
+ Set<Integer> dup = new HashSet<>();
dup.addAll(found);
dup.removeAll(ex2);
ex2.removeAll(found);
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/states/EventList.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/states/EventList.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/states/EventList.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/states/EventList.java Tue Jun 24 09:06:50 2014
@@ -67,8 +67,10 @@ class EventList implements Attributes, C
public EventList() {
}
public EventList(String[] ev) {
- for (int i=0;i<ev.length;i++)
- add(TestData.short2Event.get(ev[i]));
+ for ( String anEv : ev )
+ {
+ add( TestData.short2Event.get( anEv ) );
+ }
}
public EventList copy() {
try {
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/states/EventRecord.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/states/EventRecord.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/states/EventRecord.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/states/EventRecord.java Tue Jun 24 09:06:50 2014
@@ -25,15 +25,17 @@ class EventRecord {
@Override
public String toString() {
- StringBuffer buf = new StringBuffer(toString(startEvents));
+ StringBuilder buf = new StringBuilder(toString(startEvents));
buf.append(" = "+ rsltState +" " );
buf.append(toString(rsltCharacter));
return buf.toString();
}
static private String toString(String[] s) {
- StringBuffer buf = new StringBuffer();
- for (int i=0;i<s.length;i++)
- buf.append(s[i]+" ");
+ StringBuilder buf = new StringBuilder();
+ for ( String value : s )
+ {
+ buf.append( value + " " );
+ }
return buf.toString();
}
void checkStar(String st) {
@@ -49,31 +51,35 @@ class EventRecord {
public void initCounts() {
if (!inited) {
inited = true;
- for (int i=0;i<rsltCharacter.length;i++) {
+ for ( String aRsltCharacter : rsltCharacter )
+ {
int n = 0;
- try {
- n = Integer.parseInt(rsltCharacter[i].substring(1));
+ try
+ {
+ n = Integer.parseInt( aRsltCharacter.substring( 1 ) );
}
- catch (RuntimeException e) {
- System.err.println(toString());
+ catch ( RuntimeException e )
+ {
+ System.err.println( toString() );
throw e;
}
- switch (rsltCharacter[i].charAt(0)) {
- case 'T':
- triples = n;
- break;
- case 'O':
- objects = n;
- break;
- case 'P':
- preds = n;
- break;
- case 'E':
- scope = n;
- break;
- case 'R':
- reify = n;
- break;
+ switch ( aRsltCharacter.charAt( 0 ) )
+ {
+ case 'T':
+ triples = n;
+ break;
+ case 'O':
+ objects = n;
+ break;
+ case 'P':
+ preds = n;
+ break;
+ case 'E':
+ scope = n;
+ break;
+ case 'R':
+ reify = n;
+ break;
}
}
}
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/states/FullEventRecord.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/states/FullEventRecord.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/states/FullEventRecord.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/states/FullEventRecord.java Tue Jun 24 09:06:50 2014
@@ -41,10 +41,12 @@ class FullEventRecord extends EventRecor
}
@Override
public String toString() {
- StringBuffer rslt = new StringBuffer( "|"+state+"| " + super.toString());
+ StringBuilder rslt = new StringBuilder( "|"+state+"| " + super.toString());
rslt.append("{ ");
- for (int i=0;i<moreCharacter.length;i++)
- rslt.append(moreCharacter[i].toString() + " ; ");
+ for ( EventRecord aMoreCharacter : moreCharacter )
+ {
+ rslt.append( aMoreCharacter.toString() + " ; " );
+ }
rslt.append(" }");
return rslt.toString();
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/states/TestARPStates.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/states/TestARPStates.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/states/TestARPStates.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/states/TestARPStates.java Tue Jun 24 09:06:50 2014
@@ -35,7 +35,7 @@ public class TestARPStates extends TestC
public static TestSuite suite() {
TestSuite rslt = new TestSuite();
rslt.setName("ARP state machine");
- Map<String, TestSuite> tests = new HashMap<String, TestSuite>();
+ Map<String, TestSuite> tests = new HashMap<>();
try {
LineNumberReader r = new LineNumberReader(new FileReader(TestData.dataFile));
while (true) {
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/states/TestData.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/states/TestData.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/states/TestData.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/states/TestData.java Tue Jun 24 09:06:50 2014
@@ -135,22 +135,25 @@ public class TestData implements ARPErro
}
}, };
- static Map<String, Event> short2Event = new HashMap<String, Event>();
+ static Map<String, Event> short2Event = new HashMap<>();
static {
- for (int i=0;i<allEvents.length;i++) {
- String key = allEvents[i].oneChar;
- if (short2Event.get(key)!=null)
- System.err.println("Duplicate event code: "+key);
- short2Event.put(key,allEvents[i]);
+ for ( Event allEvent : allEvents )
+ {
+ String key = allEvent.oneChar;
+ if ( short2Event.get( key ) != null )
+ {
+ System.err.println( "Duplicate event code: " + key );
+ }
+ short2Event.put( key, allEvent );
}
}
- static Map<Class< ? extends FrameI>, String> state2Name = new HashMap<Class< ? extends FrameI>, String>();
+ static Map<Class< ? extends FrameI>, String> state2Name = new HashMap<>();
- static Map<Class<? extends FrameI>, String> state2ShortName = new HashMap<Class<? extends FrameI>, String>();
+ static Map<Class<? extends FrameI>, String> state2ShortName = new HashMap<>();
- static Map<String, Class<? extends FrameI>> shortName2State = new HashMap<String, Class<? extends FrameI>>();
+ static Map<String, Class<? extends FrameI>> shortName2State = new HashMap<>();
- static Map<Class<? extends FrameI>, Object[]> state2Args = new HashMap<Class<? extends FrameI>, Object[]>();
+ static Map<Class<? extends FrameI>, Object[]> state2Args = new HashMap<>();
static void add(String sh, String nm, Class< ? extends FrameI> f, Object args[]) {
state2Name.put(f, nm);
@@ -231,21 +234,25 @@ public class TestData implements ARPErro
rslt.append(eventListName(f,null));
rslt.append(" $ " + testInfo(f) + " {");
if ( eventList.testResult.getClass() != LookingForRDF.class)
-
- for (int i=0;i<characters.length;i++) {
- if (skip != null && characters[i].startsWith(skip))
- continue;
- skip = null;
- addEvents(characters[i]);
- rslt.append( " " + characters[i]+ " $ ");
- boolean testV = eventList.test(f);
- rslt.append( testInfo(f) + " ;");
- eventList.size = sz;
- if ( !testV ) {
- skip = characters[i];
- continue;
+
+ for ( String character : characters )
+ {
+ if ( skip != null && character.startsWith( skip ) )
+ {
+ continue;
+ }
+ skip = null;
+ addEvents( character );
+ rslt.append( " " + character + " $ " );
+ boolean testV = eventList.test( f );
+ rslt.append( testInfo( f ) + " ;" );
+ eventList.size = sz;
+ if ( !testV )
+ {
+ skip = character;
+ continue;
+ }
}
- }
rslt.append(" }");
data.add(rslt.toString());
inCharacterize = false;
@@ -267,8 +274,9 @@ public class TestData implements ARPErro
private void addEvents(String string) {
String all[] = string.split(" ");
- for (int i=0;i<all.length;i++){
- eventList.add(short2Event.get(all[i]));
+ for ( String anAll : all )
+ {
+ eventList.add( short2Event.get( anAll ) );
}
}
@@ -294,13 +302,17 @@ public class TestData implements ARPErro
}
if (cl == InnerXMLLiteral.class)
types[2] = Map.class;
- for (int j = 0; j < tryClasses.length; j++) {
- types[0] = tryClasses[j];
-
- try {
- frame = cl.getConstructor(types).newInstance(args);
+ for ( Class<?> tryClass : tryClasses )
+ {
+ types[0] = tryClass;
+
+ try
+ {
+ frame = cl.getConstructor( types ).newInstance( args );
break;
- } catch (NoSuchMethodException e) {
+ }
+ catch ( NoSuchMethodException e )
+ {
continue;
}
}
@@ -326,17 +338,22 @@ public class TestData implements ARPErro
eventList.testResult instanceof LookingForRDF ? 2
: 8))
return;
- for (int i = 0; i < allEvents.length; i++) {
- if (allEvents[i].isAttribute()) {
+ for ( Event allEvent : allEvents )
+ {
+ if ( allEvent.isAttribute() )
+ {
Event e = eventList.last();
- if (!(e.isElement() || (e.isAttribute() && e.hashCode() < allEvents[i]
- .hashCode())))
+ if ( !( e.isElement() || ( e.isAttribute() && e.hashCode() < allEvent.hashCode() ) ) )
+ {
continue;
- } else if (true) {
+ }
+ }
+ else if ( true )
+ {
continue;
}
- eventList.add(allEvents[i]);
- expand(f);
+ eventList.add( allEvent );
+ expand( f );
eventList.pop();
}
}
@@ -371,7 +388,7 @@ public class TestData implements ARPErro
return false;
}
- Set<String> data = new TreeSet<String>(new Comparator<String>(){
+ Set<String> data = new TreeSet<>(new Comparator<String>(){
@Override
public int compare(String arg1, String arg2) {
StringBuffer b1 = new StringBuffer(arg1).reverse();
@@ -395,11 +412,13 @@ public class TestData implements ARPErro
// System.out.println(state2ShortName.get(f) + ":" + state2Name.get(f)
// + ":" + f.getSimpleName());
localCount = 0;
- for (int i = 0; i < allEvents.length; i++) {
- if (allEvents[i].isElement()) {
+ for ( Event allEvent : allEvents )
+ {
+ if ( allEvent.isElement() )
+ {
eventList.clear();
- eventList.add(allEvents[i]);
- expand(f);
+ eventList.add( allEvent );
+ expand( f );
}
}
stats(f);
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/states/TestHandler.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/states/TestHandler.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/states/TestHandler.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/arp/states/TestHandler.java Tue Jun 24 09:06:50 2014
@@ -19,17 +19,13 @@
package com.hp.hpl.jena.rdf.arp.states;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.HashMap ;
-import org.junit.Assert;
+import org.junit.Assert ;
-import com.hp.hpl.jena.rdf.arp.impl.ANode;
-import com.hp.hpl.jena.rdf.arp.impl.ARPLocation;
-import com.hp.hpl.jena.rdf.arp.impl.Taint;
-import com.hp.hpl.jena.rdf.arp.impl.XMLHandler;
-
-import org.apache.jena.iri.IRI;
+import com.hp.hpl.jena.rdf.arp.impl.ANode ;
+import com.hp.hpl.jena.rdf.arp.impl.Taint ;
+import com.hp.hpl.jena.rdf.arp.impl.XMLHandler ;
class TestHandler extends XMLHandler {
public void wrong(String msg) {
@@ -63,7 +59,7 @@ class TestHandler extends XMLHandler {
triples = 0;
scope = 0;
this.failOnWarning = failOnWarning_;
- idsUsed = new HashMap<IRI, Map<String,ARPLocation>>();
+ idsUsed = new HashMap<>();
idsUsedCount = 0;
}
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/AbstractContainerMethods.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/AbstractContainerMethods.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/AbstractContainerMethods.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/AbstractContainerMethods.java Tue Jun 24 09:06:50 2014
@@ -97,14 +97,14 @@ public abstract class AbstractContainerM
c.add(i);
}
final NodeIterator it = c.iterator();
- for (int i = 0; i < num; i += 1)
- {
- it.nextNode();
- if (retain[i] == false)
- {
- it.remove();
- }
- }
+ for ( boolean aRetain : retain )
+ {
+ it.nextNode();
+ if ( aRetain == false )
+ {
+ it.remove();
+ }
+ }
final NodeIterator s = c.iterator();
while (s.hasNext())
{
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/AbstractTestModel.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/AbstractTestModel.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/AbstractTestModel.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/AbstractTestModel.java Tue Jun 24 09:06:50 2014
@@ -196,22 +196,24 @@ public abstract class AbstractTestModel
public void testRemoveSPO()
{
ModelCom mc = (ModelCom) ModelFactory.createDefaultModel();
- for (int i = 0; i < cases.length; i += 1)
- for (int j = 0; j < 3; j += 1)
- {
- Model content = getModel();
- Model baseContent = copy( content );
- modelAdd( content, cases[i][0] );
- Triple remove = triple( cases[i][1] );
- Node s = remove.getSubject(), p = remove.getPredicate(), o = remove.getObject();
- Resource S = (Resource) (s.equals( Node.ANY ) ? null : mc.getRDFNode( s ));
- Property P = ((p.equals( Node.ANY ) ? null : mc.getRDFNode( p ).as( Property.class )));
- RDFNode O = o.equals( Node.ANY ) ? null : mc.getRDFNode( o );
- Model expected = modelWithStatements( cases[i][2] );
- content.removeAll( S, P, O );
- Model finalContent = copy( content ).remove( baseContent );
- assertIsoModels( cases[i][1], expected, finalContent );
- }
+ for ( String[] aCase : cases )
+ {
+ for ( int j = 0; j < 3; j += 1 )
+ {
+ Model content = getModel();
+ Model baseContent = copy( content );
+ modelAdd( content, aCase[0] );
+ Triple remove = triple( aCase[1] );
+ Node s = remove.getSubject(), p = remove.getPredicate(), o = remove.getObject();
+ Resource S = (Resource) ( s.equals( Node.ANY ) ? null : mc.getRDFNode( s ) );
+ Property P = ( ( p.equals( Node.ANY ) ? null : mc.getRDFNode( p ).as( Property.class ) ) );
+ RDFNode O = o.equals( Node.ANY ) ? null : mc.getRDFNode( o );
+ Model expected = modelWithStatements( aCase[2] );
+ content.removeAll( S, P, O );
+ Model finalContent = copy( content ).remove( baseContent );
+ assertIsoModels( aCase[1], expected, finalContent );
+ }
+ }
}
public void testIsClosedDelegatedToGraph()
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/AbstractTestPackage.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/AbstractTestPackage.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/AbstractTestPackage.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/AbstractTestPackage.java Tue Jun 24 09:06:50 2014
@@ -164,7 +164,7 @@ public abstract class AbstractTestPackag
{
final Object[] args = new Object[constructorArgs.length + 1];
System.arraycopy(constructorArgs, 0, args, 0, constructorArgs.length);
- final List<Class<?>> parameterTypes = new ArrayList<Class<?>>();
+ final List<Class<?>> parameterTypes = new ArrayList<>();
for (final Object o : constructorArgs)
{
if (o instanceof TestingModelFactory)
@@ -185,18 +185,13 @@ public abstract class AbstractTestPackag
.toArray(new Class[parameterTypes.size()]));
c = cc ;
}
- catch (final SecurityException e)
- {
- e.printStackTrace();
- throw new RuntimeException(e.getMessage(), e);
- }
- catch (final NoSuchMethodException e)
+ catch (final SecurityException | NoSuchMethodException e)
{
e.printStackTrace();
throw new RuntimeException(e.getMessage(), e);
}
- for (final Method m : testClass.getMethods())
+ for (final Method m : testClass.getMethods())
{
if (m.getParameterTypes().length == 0)
{
@@ -207,27 +202,12 @@ public abstract class AbstractTestPackag
{
addTest(c.newInstance(args));
}
- catch (final IllegalArgumentException e)
- {
- e.printStackTrace();
- throw new RuntimeException(e.getMessage(), e);
- }
- catch (final InstantiationException e)
- {
- e.printStackTrace();
- throw new RuntimeException(e.getMessage(), e);
- }
- catch (final IllegalAccessException e)
- {
- e.printStackTrace();
- throw new RuntimeException(e.getMessage(), e);
- }
- catch (final InvocationTargetException e)
+ catch (final IllegalArgumentException | InvocationTargetException | IllegalAccessException | InstantiationException e)
{
e.printStackTrace();
throw new RuntimeException(e.getMessage(), e);
}
- }
+ }
}
}
}
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/AbstractTestReifiedStatements.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/AbstractTestReifiedStatements.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/AbstractTestReifiedStatements.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/AbstractTestReifiedStatements.java Tue Jun 24 09:06:50 2014
@@ -150,7 +150,7 @@ public abstract class AbstractTestReifie
{
final int i = n - 1;
final Statement s = (Statement) statements[i][0];
- final int bits = ((Integer) statements[i][1]).intValue();
+ final int bits = (Integer) statements[i][1];
testCombinations(m, R, mask, statements, i);
m.add(s);
testCombinations(m, R, mask + bits, statements, i);
@@ -387,19 +387,16 @@ public abstract class AbstractTestReifie
.createResource(AbstractTestReifiedStatements.anotherURI);
final Property PP = RR.as(Property.class);
final Object[][] statements = {
- { model.createStatement(RR, RDF.type, RDF.Statement),
- new Integer(1) },
- { model.createStatement(RR, RDF.subject, SS), new Integer(2) },
- { model.createStatement(RR, RDF.predicate, PP), new Integer(4) },
- { model.createStatement(RR, RDF.object, O), new Integer(8) },
- { model.createStatement(SS, PP, O), new Integer(16) },
- { model.createStatement(RR, PP, O), new Integer(32) },
- { model.createStatement(SS, RDF.subject, SS), new Integer(64) },
- { model.createStatement(SS, RDF.predicate, PP),
- new Integer(128) },
- { model.createStatement(SS, RDF.object, O), new Integer(256) },
- { model.createStatement(SS, RDF.type, RDF.Statement),
- new Integer(512) } };
+ { model.createStatement(RR, RDF.type, RDF.Statement), 1 },
+ { model.createStatement(RR, RDF.subject, SS), 2 },
+ { model.createStatement(RR, RDF.predicate, PP), 4 },
+ { model.createStatement(RR, RDF.object, O), 8 },
+ { model.createStatement(SS, PP, O), 16 },
+ { model.createStatement(RR, PP, O), 32 },
+ { model.createStatement(SS, RDF.subject, SS), 64 },
+ { model.createStatement(SS, RDF.predicate, PP), 128 },
+ { model.createStatement(SS, RDF.object, O), 256 },
+ { model.createStatement(SS, RDF.type, RDF.Statement), 512 } };
testCombinations(model, RR, 0, statements, statements.length);
}
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/ModelTestBase.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/ModelTestBase.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/ModelTestBase.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/ModelTestBase.java Tue Jun 24 09:06:50 2014
@@ -201,7 +201,7 @@ public class ModelTestBase extends Graph
*/
public static Resource[] resources( final Model m, final String items )
{
- final ArrayList<Resource> rl = new ArrayList<Resource>();
+ final ArrayList<Resource> rl = new ArrayList<>();
final StringTokenizer st = new StringTokenizer(items);
while (st.hasMoreTokens())
{
@@ -217,7 +217,7 @@ public class ModelTestBase extends Graph
*/
public static Set<Resource> resourceSet( final String items )
{
- final Set<Resource> result = new HashSet<Resource>();
+ final Set<Resource> result = new HashSet<>();
final StringTokenizer st = new StringTokenizer(items);
while (st.hasMoreTokens())
{
@@ -261,7 +261,7 @@ public class ModelTestBase extends Graph
*/
public static Statement[] statements( final Model m, final String facts )
{
- final ArrayList<Statement> sl = new ArrayList<Statement>();
+ final ArrayList<Statement> sl = new ArrayList<>();
final StringTokenizer st = new StringTokenizer(facts, ";");
while (st.hasMoreTokens())
{
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/RecordingModelListener.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/RecordingModelListener.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/RecordingModelListener.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/RecordingModelListener.java Tue Jun 24 09:06:50 2014
@@ -33,7 +33,7 @@ import com.hp.hpl.jena.rdf.model.StmtIte
public class RecordingModelListener implements ModelChangedListener
{
- List<Object> history = new ArrayList<Object>();
+ List<Object> history = new ArrayList<>();
@Override
public void addedStatement( Statement s )
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestList.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestList.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestList.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestList.java Tue Jun 24 09:06:50 2014
@@ -64,7 +64,7 @@ public class TestList extends AbstractMo
final Object[] expected )
{
final Logger logger = LoggerFactory.getLogger(TestList.class);
- final List<Object> expList = new ArrayList<Object>();
+ final List<Object> expList = new ArrayList<>();
for (final Object element : expected)
{
expList.add(element);
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestListSubjects.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestListSubjects.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestListSubjects.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestListSubjects.java Tue Jun 24 09:06:50 2014
@@ -70,7 +70,7 @@ public class TestListSubjects extends Ab
final List<? extends Resource> L = WrappedIterator.create(iterator)
.toList();
Assert.assertEquals(set.size(), L.size());
- Assert.assertEquals(set, new HashSet<Resource>(L));
+ Assert.assertEquals(set, new HashSet<>(L));
}
protected void fillModel()
@@ -152,7 +152,7 @@ public class TestListSubjects extends Ab
protected Set<Resource> subjectsTo( final String prefix, final int limit )
{
- final Set<Resource> result = new HashSet<Resource>();
+ final Set<Resource> result = new HashSet<>();
for (int i = 0; i < limit; i += 1)
{
result.add(ModelHelper.resource(prefix + i));
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestLiterals.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestLiterals.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestLiterals.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestLiterals.java Tue Jun 24 09:06:50 2014
@@ -142,11 +142,7 @@ public class TestLiterals extends Abstra
Assert.assertEquals(tv, l.getByte());
assertInRange(Byte.MIN_VALUE, tv, Byte.MAX_VALUE);
}
- catch (final NumberFormatException e)
- {
- assertOutsideRange(Byte.MIN_VALUE, tv, Byte.MAX_VALUE);
- }
- catch (final IllegalArgumentException e)
+ catch (final IllegalArgumentException e)
{
assertOutsideRange(Byte.MIN_VALUE, tv, Byte.MAX_VALUE);
}
@@ -155,11 +151,7 @@ public class TestLiterals extends Abstra
Assert.assertEquals(tv, l.getShort());
assertInRange(Short.MIN_VALUE, tv, Short.MAX_VALUE);
}
- catch (final NumberFormatException e)
- {
- assertOutsideRange(Short.MIN_VALUE, tv, Short.MAX_VALUE);
- }
- catch (final IllegalArgumentException e)
+ catch (final IllegalArgumentException e)
{
assertOutsideRange(Short.MIN_VALUE, tv, Short.MAX_VALUE);
}
@@ -198,11 +190,7 @@ public class TestLiterals extends Abstra
Assert.assertEquals(tv, l.getByte());
assertInRange(Byte.MIN_VALUE, tv, Byte.MAX_VALUE);
}
- catch (final NumberFormatException e)
- {
- assertOutsideRange(Byte.MIN_VALUE, tv, Byte.MAX_VALUE);
- }
- catch (final IllegalArgumentException e)
+ catch (final IllegalArgumentException e)
{
assertOutsideRange(Byte.MIN_VALUE, tv, Byte.MAX_VALUE);
}
@@ -211,11 +199,7 @@ public class TestLiterals extends Abstra
Assert.assertEquals(tv, l.getShort());
assertInRange(Short.MIN_VALUE, tv, Short.MAX_VALUE);
}
- catch (final NumberFormatException e)
- {
- assertOutsideRange(Short.MIN_VALUE, tv, Short.MAX_VALUE);
- }
- catch (final IllegalArgumentException e)
+ catch (final IllegalArgumentException e)
{
assertOutsideRange(Short.MIN_VALUE, tv, Short.MAX_VALUE);
}
@@ -224,11 +208,7 @@ public class TestLiterals extends Abstra
Assert.assertEquals(tv, l.getInt());
assertInRange(Integer.MIN_VALUE, tv, Integer.MAX_VALUE);
}
- catch (final NumberFormatException e)
- {
- assertOutsideRange(Integer.MIN_VALUE, tv, Integer.MAX_VALUE);
- }
- catch (final IllegalArgumentException e)
+ catch (final IllegalArgumentException e)
{
assertOutsideRange(Integer.MIN_VALUE, tv, Integer.MAX_VALUE);
}
@@ -266,11 +246,7 @@ public class TestLiterals extends Abstra
Assert.assertEquals(tv, l.getByte());
assertInRange(Byte.MIN_VALUE, tv, Byte.MAX_VALUE);
}
- catch (final NumberFormatException e)
- {
- assertOutsideRange(Byte.MIN_VALUE, tv, Byte.MAX_VALUE);
- }
- catch (final IllegalArgumentException e)
+ catch (final IllegalArgumentException e)
{
assertOutsideRange(Byte.MIN_VALUE, tv, Byte.MAX_VALUE);
}
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestModelBulkUpdate.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestModelBulkUpdate.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestModelBulkUpdate.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestModelBulkUpdate.java Tue Jun 24 09:06:50 2014
@@ -99,11 +99,10 @@ public class TestModelBulkUpdate extends
public void testContains( final Model m, final List<Statement> statements )
{
- for (int i = 0; i < statements.size(); i += 1)
- {
- Assert.assertTrue("it should be here",
- m.contains(statements.get(i)));
- }
+ for ( Statement statement : statements )
+ {
+ Assert.assertTrue( "it should be here", m.contains( statement ) );
+ }
}
public void testContains( final Model m, final Statement[] statements )
@@ -136,11 +135,10 @@ public class TestModelBulkUpdate extends
public void testOmits( final Model m, final List<Statement> statements )
{
- for (int i = 0; i < statements.size(); i += 1)
- {
- Assert.assertFalse("it should not be here",
- m.contains(statements.get(i)));
- }
+ for ( Statement statement : statements )
+ {
+ Assert.assertFalse( "it should not be here", m.contains( statement ) );
+ }
}
public void testOmits( final Model m, final Statement[] statements )
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestModelEvents.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestModelEvents.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestModelEvents.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestModelEvents.java Tue Jun 24 09:06:50 2014
@@ -95,7 +95,7 @@ public class TestModelEvents extends Abs
*/
public static class WatchStatementListener extends StatementListener
{
- List<Statement> statements = new ArrayList<Statement>();
+ List<Statement> statements = new ArrayList<>();
String addOrRem = "<unset>";
@Override
@@ -113,7 +113,7 @@ public class TestModelEvents extends Abs
}
finally
{
- statements = new ArrayList<Statement>();
+ statements = new ArrayList<>();
}
}
@@ -150,11 +150,11 @@ public class TestModelEvents extends Abs
public Map<Object, Integer> asBag( final List<Statement> l )
{
- final Map<Object, Integer> result = new HashMap<Object, Integer>();
- for (int i = 0; i < l.size(); i += 1)
- {
- another(result, l.get(i).asTriple());
- }
+ final Map<Object, Integer> result = new HashMap<>();
+ for ( Statement aL : l )
+ {
+ another( result, aL.asTriple() );
+ }
return result;
}
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestModelMakerImpl.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestModelMakerImpl.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestModelMakerImpl.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestModelMakerImpl.java Tue Jun 24 09:06:50 2014
@@ -44,7 +44,7 @@ public class TestModelMakerImpl extends
{
static class MockGraphMaker implements GraphMaker
{
- List<String> history = new ArrayList<String>();
+ List<String> history = new ArrayList<>();
Graph graph;
public MockGraphMaker( final Graph graph )
Modified: jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestNamespace.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestNamespace.java?rev=1605034&r1=1605033&r2=1605034&view=diff
==============================================================================
--- jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestNamespace.java (original)
+++ jena/trunk/jena-core/src/test/java/com/hp/hpl/jena/rdf/model/test/TestNamespace.java Tue Jun 24 09:06:50 2014
@@ -49,7 +49,7 @@ public class TestNamespace extends Abstr
*/
private Map<String, Set<String>> makePrefixes( final String prefixes )
{
- final Map<String, Set<String>> result = new HashMap<String, Set<String>>();
+ final Map<String, Set<String>> result = new HashMap<>();
final StringTokenizer st = new StringTokenizer(prefixes, ";");
while (st.hasMoreTokens())
{