You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by nd...@apache.org on 2006/10/17 04:17:51 UTC
svn commit: r464769 [2/2] - in
/incubator/harmony/enhanced/classlib/trunk/support/src/test/java:
javax/swing/ org/apache/harmony/testframework/serialization/ tests/support/
tests/support/resource/ tests/util/
Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_ParentException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_ParentException.java?view=diff&rev=464769&r1=464768&r2=464769
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_ParentException.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_ParentException.java Mon Oct 16 19:17:46 2006
@@ -18,5 +18,5 @@
package tests.support;
public class Support_Proxy_ParentException extends Exception {
-
+ private static final long serialVersionUID = -2760151845410887038L;
}
Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_SubException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_SubException.java?view=diff&rev=464769&r1=464768&r2=464769
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_SubException.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_SubException.java Mon Oct 16 19:17:46 2006
@@ -18,5 +18,6 @@
package tests.support;
public class Support_Proxy_SubException extends Support_Proxy_ParentException {
+ private static final long serialVersionUID = -2615472925826542925L;
}
Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_SetTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_SetTest.java?view=diff&rev=464769&r1=464768&r2=464769
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_SetTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_SetTest.java Mon Oct 16 19:17:46 2006
@@ -21,18 +21,19 @@
public class Support_SetTest extends junit.framework.TestCase {
- Set set; // must contain only the Integers 0 to 99
+ Set<Integer> set; // must contain only the Integers 0 to 99
public Support_SetTest(String p1) {
super(p1);
}
- public Support_SetTest(String p1, Set s) {
+ public Support_SetTest(String p1, Set<Integer> s) {
super(p1);
set = s;
}
- public void runTest() {
+ @Override
+ public void runTest() {
// add
assertTrue("Set Test - Adding a duplicate element changed the set",
!set.add(new Integer(50)));
Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_SimpleDateFormat.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_SimpleDateFormat.java?view=diff&rev=464769&r1=464768&r2=464769
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_SimpleDateFormat.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_SimpleDateFormat.java Mon Oct 16 19:17:46 2006
@@ -34,7 +34,8 @@
super(p1);
}
- public void runTest() {
+ @Override
+ public void runTest() {
t_formatToCharacterIterator();
t_format_with_FieldPosition();
}
@@ -158,9 +159,9 @@
t_Format(4, date, format, getDateVector4());
}
- private Vector getDateVector1() {
+ private Vector<FieldContainer> getDateVector1() {
// "19990913171901"
- Vector v = new Vector();
+ Vector<FieldContainer> v = new Vector<FieldContainer>();
v.add(new FieldContainer(0, 4, Field.YEAR));
v.add(new FieldContainer(4, 6, Field.MONTH));
v.add(new FieldContainer(6, 8, Field.DAY_OF_MONTH));
@@ -170,9 +171,9 @@
return v;
}
- private Vector getDateVector2() {
+ private Vector<FieldContainer> getDateVector2() {
// "12 3 5 March 2002 Monday"
- Vector v = new Vector();
+ Vector<FieldContainer> v = new Vector<FieldContainer>();
v.add(new FieldContainer(0, 2, Field.WEEK_OF_YEAR));
v.add(new FieldContainer(3, 4, Field.WEEK_OF_MONTH));
v.add(new FieldContainer(5, 7, Field.DAY_OF_MONTH));
@@ -182,26 +183,26 @@
return v;
}
- private Vector getDateVector3() {
+ private Vector<FieldContainer> getDateVector3() {
// "5:19 EDT"
- Vector v = new Vector();
+ Vector<FieldContainer> v = new Vector<FieldContainer>();
v.add(new FieldContainer(0, 1, Field.HOUR1));
v.add(new FieldContainer(2, 4, Field.MINUTE));
v.add(new FieldContainer(5, 8, Field.TIME_ZONE));
return v;
}
- private Vector getDateVector5() {
+ private Vector<FieldContainer> getDateVector5() {
// "5:19 -0400"
- Vector v = new Vector();
+ Vector<FieldContainer> v = new Vector<FieldContainer>();
v.add(new FieldContainer(0, 1, Field.HOUR1));
v.add(new FieldContainer(2, 4, Field.MINUTE));
v.add(new FieldContainer(5, 10, Field.TIME_ZONE));
return v;
}
- private Vector getDateVector4() {
- Vector v = new Vector();
+ private Vector<FieldContainer> getDateVector4() {
+ Vector<FieldContainer> v = new Vector<FieldContainer>();
// "AD AD 99 99 1999 9 09 Sep September 13 13 013 17 17 017 17 17 017 5
// 05
Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_StringReader.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_StringReader.java?view=diff&rev=464769&r1=464768&r2=464769
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_StringReader.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_StringReader.java Mon Oct 16 19:17:46 2006
@@ -49,10 +49,12 @@
* effect.
*
*/
- public void close() {
+ @Override
+ public void close() {
synchronized (lock) {
- if (isOpen())
- str = null;
+ if (isOpen()) {
+ str = null;
+ }
}
}
@@ -74,16 +76,19 @@
* @exception java.io.IOException
* If an error occurs attempting mark this StringReader.
*/
- public void mark(int readLimit) throws IOException {
+ @Override
+ public void mark(int readLimit) throws IOException {
if (readLimit >= 0) {
synchronized (lock) {
- if (isOpen())
- markpos = pos;
- else
- throw new IOException("StringReader is closed");
+ if (isOpen()) {
+ markpos = pos;
+ } else {
+ throw new IOException("StringReader is closed");
+ }
}
- } else
- throw new IllegalArgumentException();
+ } else {
+ throw new IllegalArgumentException();
+ }
}
/**
@@ -94,7 +99,8 @@
* <code>false</code> otherwise. This implementation always
* returns <code>true</code>.
*/
- public boolean markSupported() {
+ @Override
+ public boolean markSupported() {
return true;
}
@@ -108,14 +114,16 @@
* @exception java.io.IOException
* If the StringReader is already closed.
*/
- public int read() throws IOException {
+ @Override
+ public int read() throws IOException {
synchronized (lock) {
if (isOpen()) {
- if (pos != count)
- return str.charAt(pos++);
+ if (pos != count) {
+ return str.charAt(pos++);
+ }
return -1;
- } else
- throw new IOException("StringReader is closed");
+ }
+ throw new IOException("StringReader is closed");
}
}
@@ -136,25 +144,27 @@
* @exception java.io.IOException
* If the StringReader is closed.
*/
- public int read(char buf[], int offset, int count) throws IOException {
+ @Override
+ public int read(char buf[], int offset, int count) throws IOException {
// avoid int overflow
if (0 <= offset && offset <= buf.length && 0 <= count
&& count <= buf.length - offset) {
synchronized (lock) {
if (isOpen()) {
- if (pos == this.count)
- return -1;
+ if (pos == this.count) {
+ return -1;
+ }
int end = pos + count > this.count ? this.count : pos
+ count;
str.getChars(pos, end, buf, offset);
int read = end - pos;
pos = end;
return read;
- } else
- throw new IOException("StringReader is closed");
+ }
+ throw new IOException("StringReader is closed");
}
- } else
- throw new ArrayIndexOutOfBoundsException();
+ }
+ throw new ArrayIndexOutOfBoundsException();
}
/**
@@ -172,10 +182,12 @@
* @exception java.io.IOException
* If an IO error occurs.
*/
- public boolean ready() throws IOException {
+ @Override
+ public boolean ready() throws IOException {
synchronized (lock) {
- if (isOpen())
- return true;
+ if (isOpen()) {
+ return true;
+ }
throw new IOException("StringReader is closed");
}
}
@@ -189,12 +201,14 @@
* @exception java.io.IOException
* If this StringReader has already been closed.
*/
- public void reset() throws IOException {
+ @Override
+ public void reset() throws IOException {
synchronized (lock) {
- if (isOpen())
- pos = markpos != -1 ? markpos : 0;
- else
- throw new IOException("StringReader is closed");
+ if (isOpen()) {
+ pos = markpos != -1 ? markpos : 0;
+ } else {
+ throw new IOException("StringReader is closed");
+ }
}
}
@@ -210,11 +224,13 @@
* @exception java.io.IOException
* If this StringReader has already been closed.
*/
- public long skip(long count) throws IOException {
+ @Override
+ public long skip(long count) throws IOException {
synchronized (lock) {
if (isOpen()) {
- if (count <= 0)
- return 0;
+ if (count <= 0) {
+ return 0;
+ }
long skipped = 0;
if (count < this.count - pos) {
pos = pos + (int) count;
@@ -224,8 +240,8 @@
pos = this.count;
}
return skipped;
- } else
- throw new IOException("StringReader is closed");
+ }
+ throw new IOException("StringReader is closed");
}
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_StringWriter.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_StringWriter.java?view=diff&rev=464769&r1=464768&r2=464769
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_StringWriter.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_StringWriter.java Mon Oct 16 19:17:46 2006
@@ -43,8 +43,9 @@
if (initialSize >= 0) {
buf = new StringBuffer(initialSize);
lock = buf;
- } else
- throw new IllegalArgumentException();
+ } else {
+ throw new IllegalArgumentException();
+ }
}
/**
@@ -54,7 +55,8 @@
* @exception java.io.IOException
* If an IO error occurs closing this StringWriter.
*/
- public void close() throws IOException {
+ @Override
+ public void close() throws IOException {
}
/**
@@ -62,7 +64,8 @@
* particular implementation does nothing.
*
*/
- public void flush() {
+ @Override
+ public void flush() {
}
/**
@@ -85,7 +88,8 @@
*
* @return this StringWriters current contents as a String.
*/
- public String toString() {
+ @Override
+ public String toString() {
synchronized (lock) {
return buf.toString();
}
@@ -105,15 +109,17 @@
* @exception java.lang.ArrayIndexOutOfBoundsException
* If offset or count are outside of bounds.
*/
- public void write(char[] buf, int offset, int count) {
+ @Override
+ public void write(char[] buf, int offset, int count) {
// avoid int overflow
if (0 <= offset && offset <= buf.length && 0 <= count
&& count <= buf.length - offset) {
synchronized (lock) {
this.buf.append(buf, offset, count);
}
- } else
- throw new ArrayIndexOutOfBoundsException();
+ } else {
+ throw new ArrayIndexOutOfBoundsException();
+ }
}
/**
@@ -125,7 +131,8 @@
* The character to write
*
*/
- public void write(int oneChar) {
+ @Override
+ public void write(int oneChar) {
synchronized (lock) {
buf.append((char) oneChar);
}
@@ -139,7 +146,8 @@
* the non-null String containing the characters to write.
*
*/
- public void write(String str) {
+ @Override
+ public void write(String str) {
synchronized (lock) {
buf.append(str);
}
@@ -160,7 +168,8 @@
* @exception java.lang.ArrayIndexOutOfBoundsException
* If offset or count are outside of bounds.
*/
- public void write(String str, int offset, int count) {
+ @Override
+ public void write(String str, int offset, int count) {
String sub = str.substring(offset, offset + count);
synchronized (lock) {
buf.append(sub);
Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestProvider.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestProvider.java?view=diff&rev=464769&r1=464768&r2=464769
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestProvider.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestProvider.java Mon Oct 16 19:17:46 2006
@@ -25,7 +25,9 @@
* This class implements a dummy provider.
*/
public class Support_TestProvider extends Provider {
- // Provider name
+ private static final long serialVersionUID = 1L;
+
+ // Provider name
private static final String NAME = "TestProvider";
// Version of the services provided
@@ -47,8 +49,8 @@
* Register the services the receiver provides.
*/
private void registerServices() {
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ public Void run() {
// Digest engine
put("MessageDigest.SHA",
"made.up.provider.name.MessageDigestSHA");
Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource.java?view=diff&rev=464769&r1=464768&r2=464769
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource.java Mon Oct 16 19:17:46 2006
@@ -19,7 +19,8 @@
public class Support_TestResource extends java.util.ListResourceBundle {
- protected Object[][] getContents() {
+ @Override
+ protected Object[][] getContents() {
Object[][] contents = { { "parent1", "parentValue1" },
{ "parent2", "parentValue2" }, { "parent3", "parentValue3" },
{ "parent4", "parentValue4" }, };
Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_en.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_en.java?view=diff&rev=464769&r1=464768&r2=464769
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_en.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_en.java Mon Oct 16 19:17:46 2006
@@ -19,7 +19,8 @@
public class Support_TestResource_en extends java.util.ListResourceBundle {
- protected Object[][] getContents() {
+ @Override
+ protected Object[][] getContents() {
Object[][] contents = { { "parent2", "enValue2" },
{ "parent3", "enValue3" }, { "parent4", "enValue4" },
{ "child1", "enChildValue1" }, };
Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_en_US.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_en_US.java?view=diff&rev=464769&r1=464768&r2=464769
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_en_US.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_en_US.java Mon Oct 16 19:17:46 2006
@@ -19,7 +19,8 @@
public class Support_TestResource_en_US extends java.util.ListResourceBundle {
- protected Object[][] getContents() {
+ @Override
+ protected Object[][] getContents() {
Object[][] contents = { { "parent3", "enUSValue3" },
{ "parent4", "enUSValue4" }, { "child1", "enUSChildValue1" },
{ "child2", "enUSChildValue2" }, };
Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_fr.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_fr.java?view=diff&rev=464769&r1=464768&r2=464769
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_fr.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_fr.java Mon Oct 16 19:17:46 2006
@@ -19,7 +19,8 @@
public class Support_TestResource_fr extends java.util.ListResourceBundle {
- protected Object[][] getContents() {
+ @Override
+ protected Object[][] getContents() {
Object[][] contents = { { "parent2", "frValue2" },
{ "parent3", "frValue3" }, { "parent4", "frValue4" },
{ "child1", "frChildValue1" }, };
Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_fr_FR.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_fr_FR.java?view=diff&rev=464769&r1=464768&r2=464769
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_fr_FR.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_fr_FR.java Mon Oct 16 19:17:46 2006
@@ -19,7 +19,8 @@
public class Support_TestResource_fr_FR extends java.util.ListResourceBundle {
- protected Object[][] getContents() {
+ @Override
+ protected Object[][] getContents() {
Object[][] contents = { { "parent3", "frFRValue3" },
{ "parent4", "frFRValue4" }, { "child1", "frFRChildValue1" },
{ "child2", "frFRChildValue2" }, };
Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_fr_FR_VAR.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_fr_FR_VAR.java?view=diff&rev=464769&r1=464768&r2=464769
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_fr_FR_VAR.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_fr_FR_VAR.java Mon Oct 16 19:17:46 2006
@@ -19,7 +19,8 @@
public class Support_TestResource_fr_FR_VAR extends
java.util.ListResourceBundle {
- protected Object[][] getContents() {
+ @Override
+ protected Object[][] getContents() {
Object[][] contents = { { "parent4", "frFRVARValue4" },
{ "child1", "frFRVARChildValue1" },
{ "child2", "frFRVARChildValue2" },
Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TimeZone.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TimeZone.java?view=diff&rev=464769&r1=464768&r2=464769
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TimeZone.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TimeZone.java Mon Oct 16 19:17:46 2006
@@ -27,8 +27,9 @@
*
*/
public class Support_TimeZone extends TimeZone {
+ private static final long serialVersionUID = 1L;
- int rawOffset;
+ int rawOffset;
boolean useDaylightTime;
@@ -37,7 +38,8 @@
this.useDaylightTime = useDaylightTime;
}
- public int getRawOffset() {
+ @Override
+ public int getRawOffset() {
return rawOffset;
}
@@ -45,20 +47,23 @@
* let's assume this timezone has daylight savings from the 4th month till
* the 10th month of the year to ame things simple.
*/
- public boolean inDaylightTime(java.util.Date p1) {
- if (!useDaylightTime)
- return false;
+ @Override
+ public boolean inDaylightTime(java.util.Date p1) {
+ if (!useDaylightTime) {
+ return false;
+ }
GregorianCalendar cal = new GregorianCalendar();
cal.setTime(p1);
int month = cal.get(Calendar.MONTH);
- if (month > 4 && month < 10)
- return true;
- else
- return false;
+ if (month > 4 && month < 10) {
+ return true;
+ }
+ return false;
}
- public boolean useDaylightTime() {
+ @Override
+ public boolean useDaylightTime() {
return useDaylightTime;
}
@@ -66,11 +71,13 @@
* return 0 to keep it simple, since this subclass is not used to test this
* method..
*/
- public int getOffset(int p1, int p2, int p3, int p4, int p5, int p6) {
+ @Override
+ public int getOffset(int p1, int p2, int p3, int p4, int p5, int p6) {
return 0;
}
- public void setRawOffset(int p1) {
+ @Override
+ public void setRawOffset(int p1) {
rawOffset = p1;
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_URLConnector.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_URLConnector.java?view=diff&rev=464769&r1=464768&r2=464769
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_URLConnector.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_URLConnector.java Mon Oct 16 19:17:46 2006
@@ -50,15 +50,17 @@
* @see com.ibm.support.Support_HttpConnector#getInputStream()
*/
public InputStream getInputStream() throws IOException {
- if (instance == null)
- return null;
+ if (instance == null) {
+ return null;
+ }
streamOpen = true;
return instance.getInputStream();
}
public OutputStream getOutputStream() throws IOException {
- if (instance == null)
- return null;
+ if (instance == null) {
+ return null;
+ }
instance.setDoOutput(true);
((HttpURLConnection) instance).setRequestMethod("POST");
streamOpen = true;
Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_UnmodifiableCollectionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_UnmodifiableCollectionTest.java?view=diff&rev=464769&r1=464768&r2=464769
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_UnmodifiableCollectionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_UnmodifiableCollectionTest.java Mon Oct 16 19:17:46 2006
@@ -22,11 +22,11 @@
import java.util.Iterator;
import java.util.SortedSet;
import java.util.TreeSet;
+import junit.framework.TestCase;
-public class Support_UnmodifiableCollectionTest extends
- junit.framework.TestCase {
+public class Support_UnmodifiableCollectionTest extends TestCase {
- Collection col;
+ Collection<Integer> col;
// must be a collection containing the Integers 0 to 99 (which will iterate
// in order)
@@ -35,12 +35,13 @@
super(p1);
}
- public Support_UnmodifiableCollectionTest(String p1, Collection c) {
+ public Support_UnmodifiableCollectionTest(String p1, Collection<Integer> c) {
super(p1);
col = c;
}
- public void runTest() {
+ @Override
+ public void runTest() {
// contains
assertTrue("UnmodifiableCollectionTest - should contain 0", col
@@ -51,7 +52,7 @@
.contains(new Integer(100)));
// containsAll
- HashSet hs = new HashSet();
+ HashSet<Integer> hs = new HashSet<Integer>();
hs.add(new Integer(0));
hs.add(new Integer(25));
hs.add(new Integer(99));
@@ -68,14 +69,14 @@
.isEmpty());
// iterator
- Iterator it = col.iterator();
- SortedSet ss = new TreeSet();
+ Iterator<Integer> it = col.iterator();
+ SortedSet<Integer> ss = new TreeSet<Integer>();
while (it.hasNext()) {
ss.add(it.next());
}
it = ss.iterator();
for (int counter = 0; it.hasNext(); counter++) {
- int nextValue = ((Integer) it.next()).intValue();
+ int nextValue = it.next().intValue();
assertTrue(
"UnmodifiableCollectionTest - Iterator returned wrong value. Wanted: "
+ counter + " got: " + nextValue,
Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_UnmodifiableMapTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_UnmodifiableMapTest.java?view=diff&rev=464769&r1=464768&r2=464769
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_UnmodifiableMapTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_UnmodifiableMapTest.java Mon Oct 16 19:17:46 2006
@@ -21,10 +21,11 @@
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import junit.framework.TestCase;
-public class Support_UnmodifiableMapTest extends junit.framework.TestCase {
+public class Support_UnmodifiableMapTest extends TestCase {
- Map map;
+ Map<String, Integer> map;
// must be a map containing the string keys "0"-"99" paired with the Integer
// values Integer(0) to Integer(99)
@@ -33,12 +34,13 @@
super(p1);
}
- public Support_UnmodifiableMapTest(String p1, Map m) {
+ public Support_UnmodifiableMapTest(String p1, Map<String, Integer> m) {
super(p1);
map = m;
}
- public void runTest() {
+ @Override
+ public void runTest() {
// containsKey
assertTrue("UnmodifiableMapTest - Should contain the key \"0\"", map
.containsKey("0"));
@@ -56,11 +58,11 @@
.containsValue(new Integer(100)));
// entrySet
- Set entrySet = map.entrySet();
- Iterator entrySetIterator = entrySet.iterator();
+ Set<?> entrySet = map.entrySet();
+ Iterator<?> entrySetIterator = entrySet.iterator();
int myCounter = 0;
while (entrySetIterator.hasNext()) {
- Map.Entry me = (Map.Entry) entrySetIterator.next();
+ Map.Entry<?, ?> me = (Map.Entry<?, ?>) entrySetIterator.next();
assertTrue("UnmodifiableMapTest - Incorrect Map.Entry returned",
map.get(me.getKey()).equals(me.getValue()));
myCounter++;
@@ -70,9 +72,9 @@
// get
assertTrue("UnmodifiableMapTest - getting \"0\" didn't return 0",
- ((Integer) map.get("0")).intValue() == 0);
+ map.get("0").intValue() == 0);
assertTrue("UnmodifiableMapTest - getting \"50\" didn't return 0",
- ((Integer) map.get("0")).intValue() == 0);
+ map.get("0").intValue() == 0);
assertNull("UnmodifiableMapTest - getting \"100\" didn't return null",
map.get("100"));
@@ -82,7 +84,7 @@
!map.isEmpty());
// keySet
- Set keySet = map.keySet();
+ Set<?> keySet = map.keySet();
t_KeySet(keySet);
// size
@@ -95,7 +97,7 @@
}
- void t_KeySet(Set keySet) {
+ void t_KeySet(Set<?> keySet) {
// keySet should be a set of the strings "0" to "99"
// contains
@@ -108,7 +110,7 @@
!keySet.contains("100"));
// containsAll
- HashSet hs = new HashSet();
+ HashSet<String> hs = new HashSet<String>();
hs.add("0");
hs.add("25");
hs.add("99");
@@ -125,7 +127,7 @@
!keySet.isEmpty());
// iterator
- Iterator it = keySet.iterator();
+ Iterator<?> it = keySet.iterator();
while (it.hasNext()) {
assertTrue(
"UnmodifiableMapTest - keySetTest - Iterator returned wrong values",
Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/resource/Support_Resources.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/resource/Support_Resources.java?view=diff&rev=464769&r1=464768&r2=464769
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/resource/Support_Resources.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/resource/Support_Resources.java Mon Oct 16 19:17:46 2006
@@ -51,8 +51,9 @@
copyFile(resources, folder, name);
URL url = null;
String resPath = resources.toString();
- if (resPath.charAt(0) == '/' || resPath.charAt(0) == '\\')
- resPath = resPath.substring(1);
+ if (resPath.charAt(0) == '/' || resPath.charAt(0) == '\\') {
+ resPath = resPath.substring(1);
+ }
try {
url = new URL("file:/" + resPath + "/" + fileName);
} catch (MalformedURLException e) {
@@ -85,8 +86,9 @@
f.mkdirs();
f.deleteOnExit();
}
- } else
- f = root;
+ } else {
+ f = root;
+ }
File dest = new File(f.toString() + "/" + file);
@@ -113,8 +115,9 @@
FileOutputStream out = new FileOutputStream(dest);
int result;
byte[] buf = new byte[4096];
- while ((result = in.read(buf)) != -1)
- out.write(buf, 0, result);
+ while ((result = in.read(buf)) != -1) {
+ out.write(buf, 0, result);
+ }
in.close();
out.close();
dest.deleteOnExit();
Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/CallVerificationStack.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/CallVerificationStack.java?view=diff&rev=464769&r1=464768&r2=464769
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/CallVerificationStack.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/CallVerificationStack.java Mon Oct 16 19:17:46 2006
@@ -23,7 +23,7 @@
* A stack to store the parameters of a call, as well as the call stack.
*
*/
-public class CallVerificationStack extends Stack {
+public class CallVerificationStack extends Stack<Object> {
/*
* --------------------------------------------------------------------
@@ -34,7 +34,7 @@
private static final long serialVersionUID = 1L;
// the singleton
- private static CallVerificationStack _instance = new CallVerificationStack();
+ private static final CallVerificationStack _instance = new CallVerificationStack();
/*
* --------------------------------------------------------------------
@@ -43,7 +43,7 @@
*/
// the call stack, store StackTraceElement
- private Stack callStack = new Stack();
+ private final Stack<StackTraceElement> callStack = new Stack<StackTraceElement>();
/*
* -------------------------------------------------------------------
@@ -93,7 +93,7 @@
* @return the "current" calling class name
*/
public String getCurrentSourceClass() {
- return ((StackTraceElement) this.callStack.peek()).getClassName();
+ return this.callStack.peek().getClassName();
}
/**
@@ -102,25 +102,21 @@
* @return the "current" calling method name
*/
public String getCurrentSourceMethod() {
- return ((StackTraceElement) this.callStack.peek()).getMethodName();
+ return this.callStack.peek().getMethodName();
}
/**
* Clear the parameter stack and the call stack.
*
*/
- public void clear() {
+ @Override
+ public void clear() {
this.callStack.clear();
super.clear();
}
- /**
- * Pushes an object onto the top of this stack.
- *
- * @param o
- * the object to push
- */
- public Object push(Object o) {
+ @Override
+ public Object push(Object o) {
pushCallStack();
return super.push(o);
}
@@ -200,7 +196,8 @@
*
* @return the object
*/
- public Object pop() {
+ @Override
+ public Object pop() {
this.callStack.pop();
return super.pop();
}
Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/SerializationTester.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/SerializationTester.java?view=diff&rev=464769&r1=464768&r2=464769
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/SerializationTester.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/SerializationTester.java Mon Oct 16 19:17:46 2006
@@ -75,7 +75,7 @@
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
- Object outputObject = (Object) ois.readObject();
+ Object outputObject = ois.readObject();
lastOutput = outputObject;
ois.close();
return outputObject;
Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/SomeTests.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/SomeTests.java?view=diff&rev=464769&r1=464768&r2=464769
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/SomeTests.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/SomeTests.java Mon Oct 16 19:17:46 2006
@@ -66,7 +66,7 @@
private Node excludesDoc;
- private List runCases = new ArrayList();
+ private final List<TestCase> runCases = new ArrayList<TestCase>();
private String excludesListURI;
@@ -97,12 +97,13 @@
*
* @see junit.extensions.TestDecorator#basicRun(junit.framework.TestResult)
*/
- public void basicRun(TestResult result) {
+ @Override
+ public void basicRun(TestResult result) {
// The 'basic run' of this decorator is to enumerate through all
// of the tests not excluded and run them...
- Iterator allIncluded = runCases.iterator();
+ Iterator<TestCase> allIncluded = runCases.iterator();
while (allIncluded.hasNext()) {
- TestCase test = (TestCase) allIncluded.next();
+ TestCase test = allIncluded.next();
test.run(result);
}// end while
}
@@ -112,7 +113,8 @@
*
* @see junit.extensions.TestSetup#setUp()
*/
- protected void setUp() throws Exception {
+ @Override
+ protected void setUp() throws Exception {
if (docIsValid) {
System.out.println("\nExcludes list document " + excludesListURI
+ " is valid");
@@ -122,7 +124,8 @@
+ " possible test cases\n");
}
- protected void tearDown() throws Exception {
+ @Override
+ protected void tearDown() throws Exception {
System.out.println("\nRan " + this.countTestCases()
+ " out of a total of " + this.originalTestCaseCount
+ " possible test cases\n");
@@ -164,12 +167,13 @@
*
* @see junit.framework.Test#countTestCases()
*/
- public int countTestCases() {
+ @Override
+ public int countTestCases() {
return runCases.size();
}
private void seekTests(TestSuite suite) {
- Enumeration allTests = suite.tests();
+ Enumeration<?> allTests = suite.tests();
while (allTests.hasMoreElements()) {
Test test = (Test) allTests.nextElement();
seekTests(test);
@@ -309,12 +313,14 @@
private SAXParseException spException = null;
- public void error(SAXParseException exception) throws SAXException {
+ @Override
+ public void error(SAXParseException exception) throws SAXException {
inError = true;
spException = exception;
}
- public void fatalError(SAXParseException exception) throws SAXException {
+ @Override
+ public void fatalError(SAXParseException exception) throws SAXException {
inError = true;
spException = exception;
}