You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by sm...@apache.org on 2006/08/29 07:40:47 UTC
svn commit: r437974 [1/19] -
/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/
Author: smishura
Date: Mon Aug 28 22:40:44 2006
New Revision: 437974
URL: http://svn.apache.org/viewvc?rev=437974&view=rev
Log:
Set eol-style=native
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ArithmeticExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ArrayIndexOutOfBoundsExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ArrayStoreExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/BooleanTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ByteTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/CharacterTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/Character_UnicodeBlockTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ClassCastExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ClassNotFoundExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ClassTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/CloneNotSupportedExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/CompilerTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/DoubleTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/EnumConstantNotPresentExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ErrorTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ExceptionInInitializerErrorTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/FloatTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalAccessErrorTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalAccessExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalArgumentExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalMonitorStateExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalStateExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IllegalThreadStateExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IncompatibleClassChangeErrorTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IndexOutOfBoundsExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InheritableThreadLocalTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InstantiationErrorTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InstantiationExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/IntegerTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InternalErrorTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/InterruptedExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/LinkageErrorTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/LongTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/MathTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NegativeArraySizeExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoClassDefFoundErrorTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoSuchFieldErrorTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoSuchFieldExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoSuchMethodErrorTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NoSuchMethodExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NullPointerExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NumberFormatExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/NumberTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ObjectTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/OutOfMemoryErrorTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/PackageTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/RuntimeExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/RuntimePermissionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/RuntimeTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/SecurityExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/SecurityManagerTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ShortTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StackOverflowErrorTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StrictMathTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StringBufferTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StringBuilderTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StringIndexOutOfBoundsExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/SystemTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ThreadDeathTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ThreadGroupTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ThreadLocalTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ThreadTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ThrowableTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/UnknownErrorTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/UnsatisfiedLinkErrorTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/UnsupportedOperationExceptionTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/VerifyErrorTest.java (contents, props changed)
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/VirtualMachineErrorTest.java (contents, props changed)
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ArithmeticExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ArithmeticExceptionTest.java?rev=437974&r1=437973&r2=437974&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ArithmeticExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ArithmeticExceptionTest.java Mon Aug 28 22:40:44 2006
@@ -1,39 +1,39 @@
-/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.harmony.luni.tests.java.lang;
-
-import junit.framework.TestCase;
-
-public class ArithmeticExceptionTest extends TestCase {
-
- /**
- * @tests java.lang.ArithmeticException#ArithmeticException()
- */
- public void test_Constructor() {
- ArithmeticException e = new ArithmeticException();
- assertNull(e.getMessage());
- assertNull(e.getCause());
- }
-
- /**
- * @tests java.lang.ArithmeticException#ArithmeticException(java.lang.String)
- */
- public void test_ConstructorLjava_lang_String() {
- ArithmeticException e = new ArithmeticException("fixture");
- assertEquals("fixture", e.getMessage());
- assertNull(e.getCause());
- }
-}
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.luni.tests.java.lang;
+
+import junit.framework.TestCase;
+
+public class ArithmeticExceptionTest extends TestCase {
+
+ /**
+ * @tests java.lang.ArithmeticException#ArithmeticException()
+ */
+ public void test_Constructor() {
+ ArithmeticException e = new ArithmeticException();
+ assertNull(e.getMessage());
+ assertNull(e.getCause());
+ }
+
+ /**
+ * @tests java.lang.ArithmeticException#ArithmeticException(java.lang.String)
+ */
+ public void test_ConstructorLjava_lang_String() {
+ ArithmeticException e = new ArithmeticException("fixture");
+ assertEquals("fixture", e.getMessage());
+ assertNull(e.getCause());
+ }
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ArithmeticExceptionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ArrayIndexOutOfBoundsExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ArrayIndexOutOfBoundsExceptionTest.java?rev=437974&r1=437973&r2=437974&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ArrayIndexOutOfBoundsExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ArrayIndexOutOfBoundsExceptionTest.java Mon Aug 28 22:40:44 2006
@@ -1,50 +1,50 @@
-/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.harmony.luni.tests.java.lang;
-
-import junit.framework.TestCase;
-
-public class ArrayIndexOutOfBoundsExceptionTest extends TestCase {
-
- /**
- * @tests java.lang.ArrayIndexOutOfBoundsException#ArrayIndexOutOfBoundsException(int)
- */
- public void test_ConstructorI() {
- ArrayIndexOutOfBoundsException e = new ArrayIndexOutOfBoundsException(-1);
- assertNotNull(e.getMessage());
- assertTrue("Unable to find index value in 'message' property.", e.getMessage().indexOf(
- "-1", 0) >= 0);
-
- }
-
- /**
- * @tests java.lang.ArrayIndexOutOfBoundsException#ArrayIndexOutOfBoundsException()
- */
- public void test_Constructor() {
- ArrayIndexOutOfBoundsException e = new ArrayIndexOutOfBoundsException();
- assertNull(e.getMessage());
- assertNull(e.getCause());
- }
-
- /**
- * @tests java.lang.ArrayIndexOutOfBoundsException#ArrayIndexOutOfBoundsException(java.lang.String)
- */
- public void test_ConstructorLjava_lang_String() {
- ArrayIndexOutOfBoundsException e = new ArrayIndexOutOfBoundsException("fixture");
- assertEquals("fixture", e.getMessage());
- assertNull(e.getCause());
- }
-}
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.luni.tests.java.lang;
+
+import junit.framework.TestCase;
+
+public class ArrayIndexOutOfBoundsExceptionTest extends TestCase {
+
+ /**
+ * @tests java.lang.ArrayIndexOutOfBoundsException#ArrayIndexOutOfBoundsException(int)
+ */
+ public void test_ConstructorI() {
+ ArrayIndexOutOfBoundsException e = new ArrayIndexOutOfBoundsException(-1);
+ assertNotNull(e.getMessage());
+ assertTrue("Unable to find index value in 'message' property.", e.getMessage().indexOf(
+ "-1", 0) >= 0);
+
+ }
+
+ /**
+ * @tests java.lang.ArrayIndexOutOfBoundsException#ArrayIndexOutOfBoundsException()
+ */
+ public void test_Constructor() {
+ ArrayIndexOutOfBoundsException e = new ArrayIndexOutOfBoundsException();
+ assertNull(e.getMessage());
+ assertNull(e.getCause());
+ }
+
+ /**
+ * @tests java.lang.ArrayIndexOutOfBoundsException#ArrayIndexOutOfBoundsException(java.lang.String)
+ */
+ public void test_ConstructorLjava_lang_String() {
+ ArrayIndexOutOfBoundsException e = new ArrayIndexOutOfBoundsException("fixture");
+ assertEquals("fixture", e.getMessage());
+ assertNull(e.getCause());
+ }
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ArrayIndexOutOfBoundsExceptionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ArrayStoreExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ArrayStoreExceptionTest.java?rev=437974&r1=437973&r2=437974&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ArrayStoreExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ArrayStoreExceptionTest.java Mon Aug 28 22:40:44 2006
@@ -1,40 +1,40 @@
-/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.harmony.luni.tests.java.lang;
-
-import junit.framework.TestCase;
-
-public class ArrayStoreExceptionTest extends TestCase {
-
- /**
- * @tests java.lang.ArrayStoreException#ArrayStoreException()
- */
- public void test_Constructor() {
- ArrayStoreException e = new ArrayStoreException();
- assertNull(e.getMessage());
- assertNull(e.getLocalizedMessage());
- assertNull(e.getCause());
- }
-
- /**
- * @tests java.lang.ArrayStoreException#ArrayStoreException(java.lang.String)
- */
- public void test_ConstructorLjava_lang_String() {
- ArrayStoreException e = new ArrayStoreException("fixture");
- assertEquals("fixture", e.getMessage());
- assertNull(e.getCause());
- }
-}
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.luni.tests.java.lang;
+
+import junit.framework.TestCase;
+
+public class ArrayStoreExceptionTest extends TestCase {
+
+ /**
+ * @tests java.lang.ArrayStoreException#ArrayStoreException()
+ */
+ public void test_Constructor() {
+ ArrayStoreException e = new ArrayStoreException();
+ assertNull(e.getMessage());
+ assertNull(e.getLocalizedMessage());
+ assertNull(e.getCause());
+ }
+
+ /**
+ * @tests java.lang.ArrayStoreException#ArrayStoreException(java.lang.String)
+ */
+ public void test_ConstructorLjava_lang_String() {
+ ArrayStoreException e = new ArrayStoreException("fixture");
+ assertEquals("fixture", e.getMessage());
+ assertNull(e.getCause());
+ }
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ArrayStoreExceptionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/BooleanTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/BooleanTest.java?rev=437974&r1=437973&r2=437974&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/BooleanTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/BooleanTest.java Mon Aug 28 22:40:44 2006
@@ -1,156 +1,156 @@
-/* Copyright 2006 The Apache Software Foundation or its licensors, as applicable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.harmony.luni.tests.java.lang;
-
-import junit.framework.TestCase;
-
-public class BooleanTest extends TestCase {
-
- /**
- * @tests java.lang.Boolean#hashCode()
- */
- public void test_hashCode() {
- assertEquals(1231, Boolean.TRUE.hashCode());
- assertEquals(1237, Boolean.FALSE.hashCode());
- }
-
- /**
- * @tests java.lang.Boolean#Boolean(String)
- */
- public void test_ConstructorLjava_lang_String() {
- assertEquals(Boolean.TRUE, new Boolean("TRUE"));
- assertEquals(Boolean.TRUE, new Boolean("true"));
- assertEquals(Boolean.TRUE, new Boolean("True"));
-
- assertEquals(Boolean.FALSE, new Boolean("yes"));
- assertEquals(Boolean.FALSE, new Boolean("false"));
- }
-
- /**
- * @tests java.lang.Boolean#Boolean(boolean)
- */
- public void test_ConstructorZ() {
- assertEquals(Boolean.TRUE, new Boolean(true));
- assertEquals(Boolean.FALSE, new Boolean(false));
- }
-
- /**
- * @tests java.lang.Boolean#booleanValue()
- */
- public void test_booleanValue() {
- assertTrue(Boolean.TRUE.booleanValue());
- assertFalse(Boolean.FALSE.booleanValue());
- }
-
- /**
- * @tests java.lang.Boolean#equals(Object)
- */
- public void test_equalsLjava_lang_Object() {
- assertTrue(Boolean.TRUE.equals(Boolean.TRUE));
- assertTrue(Boolean.TRUE.equals(new Boolean(true)));
- assertFalse(Boolean.TRUE.equals("true"));
- assertFalse(Boolean.TRUE.equals(null));
- assertFalse(Boolean.FALSE.equals(Boolean.TRUE));
- assertTrue(Boolean.FALSE.equals(Boolean.FALSE));
- assertTrue(Boolean.FALSE.equals(new Boolean(false)));
- }
-
- /**
- * @tests java.lang.Boolean#getBoolean(String)
- */
- public void test_getBooleanLjava_lang_String() {
- System.setProperty(getClass().getName(), "true");
- assertTrue(Boolean.getBoolean(getClass().getName()));
-
- System.setProperty(getClass().getName(), "TRUE");
- assertTrue(Boolean.getBoolean(getClass().getName()));
-
- System.setProperty(getClass().getName(), "false");
- assertFalse(Boolean.getBoolean(getClass().getName()));
- }
-
- /**
- * @tests java.lang.Boolean#toString()
- */
- public void test_toString() {
- assertEquals("true", Boolean.TRUE.toString());
- assertEquals("false", Boolean.FALSE.toString());
- }
-
- /**
- * @tests java.lang.Boolean#toString(boolean)
- */
- public void test_toStringZ() {
- assertEquals("true", Boolean.toString(true));
- assertEquals("false", Boolean.toString(false));
- }
-
- /**
- * @tests java.lang.Boolean#valueOf(String)
- */
- public void test_valueOfLjava_lang_String() {
- assertEquals(Boolean.TRUE, Boolean.valueOf("true"));
- assertEquals(Boolean.FALSE, Boolean.valueOf("false"));
-
- assertEquals(Boolean.TRUE, Boolean.valueOf("TRUE"));
- assertEquals(Boolean.FALSE, Boolean.valueOf("false"));
-
- assertEquals(Boolean.FALSE, Boolean.valueOf(null));
- assertEquals(Boolean.FALSE, Boolean.valueOf(""));
- assertEquals(Boolean.FALSE, Boolean.valueOf("invalid"));
-
- assertTrue("Failed to parse true to true", Boolean.valueOf("true").booleanValue());
- assertTrue("Failed to parse mixed case true to true", Boolean.valueOf("TrUe")
- .booleanValue());
- assertTrue("parsed non-true to true", !Boolean.valueOf("ddddd").booleanValue());
- }
-
- /**
- * @tests java.lang.Boolean#valueOf(boolean)
- */
- public void test_valueOfZ() {
- assertEquals(Boolean.TRUE, Boolean.valueOf(true));
- assertEquals(Boolean.FALSE, Boolean.valueOf(false));
- }
-
- /**
- * @tests java.lang.Boolean#parseBoolean(String)
- */
- public void test_parseBooleanLjava_lang_String() {
- assertTrue(Boolean.parseBoolean("true"));
- assertTrue(Boolean.parseBoolean("TRUE"));
- assertFalse(Boolean.parseBoolean("false"));
- assertFalse(Boolean.parseBoolean(null));
- assertFalse(Boolean.parseBoolean(""));
- assertFalse(Boolean.parseBoolean("invalid"));
- }
-
- /**
- * @tests java.lang.Boolean#compareTo(Boolean)
- */
- public void test_compareToLjava_lang_Boolean() {
- assertTrue(Boolean.TRUE.compareTo(Boolean.TRUE) == 0);
- assertTrue(Boolean.FALSE.compareTo(Boolean.FALSE) == 0);
- assertTrue(Boolean.TRUE.compareTo(Boolean.FALSE) > 0);
- assertTrue(Boolean.FALSE.compareTo(Boolean.TRUE) < 0);
-
- try {
- Boolean.TRUE.compareTo(null);
- fail("No NPE");
- } catch (NullPointerException e) {
- }
- }
-}
+/* Copyright 2006 The Apache Software Foundation or its licensors, as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.luni.tests.java.lang;
+
+import junit.framework.TestCase;
+
+public class BooleanTest extends TestCase {
+
+ /**
+ * @tests java.lang.Boolean#hashCode()
+ */
+ public void test_hashCode() {
+ assertEquals(1231, Boolean.TRUE.hashCode());
+ assertEquals(1237, Boolean.FALSE.hashCode());
+ }
+
+ /**
+ * @tests java.lang.Boolean#Boolean(String)
+ */
+ public void test_ConstructorLjava_lang_String() {
+ assertEquals(Boolean.TRUE, new Boolean("TRUE"));
+ assertEquals(Boolean.TRUE, new Boolean("true"));
+ assertEquals(Boolean.TRUE, new Boolean("True"));
+
+ assertEquals(Boolean.FALSE, new Boolean("yes"));
+ assertEquals(Boolean.FALSE, new Boolean("false"));
+ }
+
+ /**
+ * @tests java.lang.Boolean#Boolean(boolean)
+ */
+ public void test_ConstructorZ() {
+ assertEquals(Boolean.TRUE, new Boolean(true));
+ assertEquals(Boolean.FALSE, new Boolean(false));
+ }
+
+ /**
+ * @tests java.lang.Boolean#booleanValue()
+ */
+ public void test_booleanValue() {
+ assertTrue(Boolean.TRUE.booleanValue());
+ assertFalse(Boolean.FALSE.booleanValue());
+ }
+
+ /**
+ * @tests java.lang.Boolean#equals(Object)
+ */
+ public void test_equalsLjava_lang_Object() {
+ assertTrue(Boolean.TRUE.equals(Boolean.TRUE));
+ assertTrue(Boolean.TRUE.equals(new Boolean(true)));
+ assertFalse(Boolean.TRUE.equals("true"));
+ assertFalse(Boolean.TRUE.equals(null));
+ assertFalse(Boolean.FALSE.equals(Boolean.TRUE));
+ assertTrue(Boolean.FALSE.equals(Boolean.FALSE));
+ assertTrue(Boolean.FALSE.equals(new Boolean(false)));
+ }
+
+ /**
+ * @tests java.lang.Boolean#getBoolean(String)
+ */
+ public void test_getBooleanLjava_lang_String() {
+ System.setProperty(getClass().getName(), "true");
+ assertTrue(Boolean.getBoolean(getClass().getName()));
+
+ System.setProperty(getClass().getName(), "TRUE");
+ assertTrue(Boolean.getBoolean(getClass().getName()));
+
+ System.setProperty(getClass().getName(), "false");
+ assertFalse(Boolean.getBoolean(getClass().getName()));
+ }
+
+ /**
+ * @tests java.lang.Boolean#toString()
+ */
+ public void test_toString() {
+ assertEquals("true", Boolean.TRUE.toString());
+ assertEquals("false", Boolean.FALSE.toString());
+ }
+
+ /**
+ * @tests java.lang.Boolean#toString(boolean)
+ */
+ public void test_toStringZ() {
+ assertEquals("true", Boolean.toString(true));
+ assertEquals("false", Boolean.toString(false));
+ }
+
+ /**
+ * @tests java.lang.Boolean#valueOf(String)
+ */
+ public void test_valueOfLjava_lang_String() {
+ assertEquals(Boolean.TRUE, Boolean.valueOf("true"));
+ assertEquals(Boolean.FALSE, Boolean.valueOf("false"));
+
+ assertEquals(Boolean.TRUE, Boolean.valueOf("TRUE"));
+ assertEquals(Boolean.FALSE, Boolean.valueOf("false"));
+
+ assertEquals(Boolean.FALSE, Boolean.valueOf(null));
+ assertEquals(Boolean.FALSE, Boolean.valueOf(""));
+ assertEquals(Boolean.FALSE, Boolean.valueOf("invalid"));
+
+ assertTrue("Failed to parse true to true", Boolean.valueOf("true").booleanValue());
+ assertTrue("Failed to parse mixed case true to true", Boolean.valueOf("TrUe")
+ .booleanValue());
+ assertTrue("parsed non-true to true", !Boolean.valueOf("ddddd").booleanValue());
+ }
+
+ /**
+ * @tests java.lang.Boolean#valueOf(boolean)
+ */
+ public void test_valueOfZ() {
+ assertEquals(Boolean.TRUE, Boolean.valueOf(true));
+ assertEquals(Boolean.FALSE, Boolean.valueOf(false));
+ }
+
+ /**
+ * @tests java.lang.Boolean#parseBoolean(String)
+ */
+ public void test_parseBooleanLjava_lang_String() {
+ assertTrue(Boolean.parseBoolean("true"));
+ assertTrue(Boolean.parseBoolean("TRUE"));
+ assertFalse(Boolean.parseBoolean("false"));
+ assertFalse(Boolean.parseBoolean(null));
+ assertFalse(Boolean.parseBoolean(""));
+ assertFalse(Boolean.parseBoolean("invalid"));
+ }
+
+ /**
+ * @tests java.lang.Boolean#compareTo(Boolean)
+ */
+ public void test_compareToLjava_lang_Boolean() {
+ assertTrue(Boolean.TRUE.compareTo(Boolean.TRUE) == 0);
+ assertTrue(Boolean.FALSE.compareTo(Boolean.FALSE) == 0);
+ assertTrue(Boolean.TRUE.compareTo(Boolean.FALSE) > 0);
+ assertTrue(Boolean.FALSE.compareTo(Boolean.TRUE) < 0);
+
+ try {
+ Boolean.TRUE.compareTo(null);
+ fail("No NPE");
+ } catch (NullPointerException e) {
+ }
+ }
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/BooleanTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ByteTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ByteTest.java?rev=437974&r1=437973&r2=437974&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ByteTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ByteTest.java Mon Aug 28 22:40:44 2006
@@ -1,671 +1,671 @@
-/* Copyright 2006 The Apache Software Foundation or its licensors, as applicable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.harmony.luni.tests.java.lang;
-
-import junit.framework.TestCase;
-
-public class ByteTest extends TestCase {
-
- /**
- * @tests java.lang.Byte#valueOf(byte)
- */
- public void test_valueOfB() {
- assertEquals(new Byte(Byte.MIN_VALUE), Byte.valueOf(Byte.MIN_VALUE));
- assertEquals(new Byte(Byte.MAX_VALUE), Byte.valueOf(Byte.MAX_VALUE));
- assertEquals(new Byte((byte) 0), Byte.valueOf((byte) 0));
-
- byte b = Byte.MIN_VALUE + 1;
- while (b < Byte.MAX_VALUE) {
- assertEquals(new Byte(b), Byte.valueOf(b));
- assertSame(Byte.valueOf(b), Byte.valueOf(b));
- b++;
- }
- }
-
- /**
- * @tests java.lang.Byte#hashCode()
- */
- public void test_hashCode() {
- assertEquals(1, new Byte((byte) 1).hashCode());
- assertEquals(2, new Byte((byte) 2).hashCode());
- assertEquals(0, new Byte((byte) 0).hashCode());
- assertEquals(-1, new Byte((byte) -1).hashCode());
- }
-
- /**
- * @tests java.lang.Byte#Byte(String)
- */
- public void test_ConstructorLjava_lang_String() {
- assertEquals(new Byte((byte) 0), new Byte("0"));
- assertEquals(new Byte((byte) 1), new Byte("1"));
- assertEquals(new Byte((byte) -1), new Byte("-1"));
-
- try {
- new Byte("0x1");
- fail("Expected NumberFormatException with hex string.");
- } catch (NumberFormatException e) {
- }
-
- try {
- new Byte("9.2");
- fail("Expected NumberFormatException with floating point string.");
- } catch (NumberFormatException e) {
- }
-
- try {
- new Byte("");
- fail("Expected NumberFormatException with empty string.");
- } catch (NumberFormatException e) {
- }
-
- try {
- new Byte(null);
- fail("Expected NumberFormatException with null string.");
- } catch (NumberFormatException e) {
- }
- }
-
- /**
- * @tests java.lang.Byte#Byte(byte)
- */
- public void test_ConstructorB() {
- assertEquals(1, new Byte((byte) 1).byteValue());
- assertEquals(2, new Byte((byte) 2).byteValue());
- assertEquals(0, new Byte((byte) 0).byteValue());
- assertEquals(-1, new Byte((byte) -1).byteValue());
- }
-
- /**
- * @tests java.lang.Byte#byteValue()
- */
- public void test_booleanValue() {
- assertEquals(1, new Byte((byte) 1).byteValue());
- assertEquals(2, new Byte((byte) 2).byteValue());
- assertEquals(0, new Byte((byte) 0).byteValue());
- assertEquals(-1, new Byte((byte) -1).byteValue());
- }
-
- /**
- * @tests java.lang.Byte#equals(Object)
- */
- public void test_equalsLjava_lang_Object() {
- assertEquals(new Byte((byte) 0), Byte.valueOf((byte) 0));
- assertEquals(new Byte((byte) 1), Byte.valueOf((byte) 1));
- assertEquals(new Byte((byte) -1), Byte.valueOf((byte) -1));
-
- Byte fixture = new Byte((byte) 25);
- assertEquals(fixture, fixture);
- assertFalse(fixture.equals(null));
- assertFalse(fixture.equals("Not a Byte"));
- }
-
- /**
- * @tests java.lang.Byte#toString()
- */
- public void test_toString() {
- assertEquals("-1", new Byte((byte) -1).toString());
- assertEquals("0", new Byte((byte) 0).toString());
- assertEquals("1", new Byte((byte) 1).toString());
- assertEquals("-1", new Byte((byte) 0xFF).toString());
- }
-
- /**
- * @tests java.lang.Byte#toString(byte)
- */
- public void test_toStringB() {
- assertEquals("-1", Byte.toString((byte) -1));
- assertEquals("0", Byte.toString((byte) 0));
- assertEquals("1", Byte.toString((byte) 1));
- assertEquals("-1", Byte.toString((byte) 0xFF));
- }
-
- /**
- * @tests java.lang.Byte#valueOf(String)
- */
- public void test_valueOfLjava_lang_String() {
- assertEquals(new Byte((byte) 0), Byte.valueOf("0"));
- assertEquals(new Byte((byte) 1), Byte.valueOf("1"));
- assertEquals(new Byte((byte) -1), Byte.valueOf("-1"));
-
- try {
- Byte.valueOf("0x1");
- fail("Expected NumberFormatException with hex string.");
- } catch (NumberFormatException e) {
- }
-
- try {
- Byte.valueOf("9.2");
- fail("Expected NumberFormatException with floating point string.");
- } catch (NumberFormatException e) {
- }
-
- try {
- Byte.valueOf("");
- fail("Expected NumberFormatException with empty string.");
- } catch (NumberFormatException e) {
- }
-
- try {
- Byte.valueOf(null);
- fail("Expected NumberFormatException with null string.");
- } catch (NumberFormatException e) {
- }
- }
-
- /**
- * @tests java.lang.Byte#valueOf(String,int)
- */
- public void test_valueOfLjava_lang_StringI() {
- assertEquals(new Byte((byte) 0), Byte.valueOf("0", 10));
- assertEquals(new Byte((byte) 1), Byte.valueOf("1", 10));
- assertEquals(new Byte((byte) -1), Byte.valueOf("-1", 10));
-
- //must be consistent with Character.digit()
- assertEquals(Character.digit('1', 2), Byte.valueOf("1", 2).byteValue());
- assertEquals(Character.digit('F', 16), Byte.valueOf("F", 16).byteValue());
-
- try {
- Byte.valueOf("0x1", 10);
- fail("Expected NumberFormatException with hex string.");
- } catch (NumberFormatException e) {
- }
-
- try {
- Byte.valueOf("9.2", 10);
- fail("Expected NumberFormatException with floating point string.");
- } catch (NumberFormatException e) {
- }
-
- try {
- Byte.valueOf("", 10);
- fail("Expected NumberFormatException with empty string.");
- } catch (NumberFormatException e) {
- }
-
- try {
- Byte.valueOf(null, 10);
- fail("Expected NumberFormatException with null string.");
- } catch (NumberFormatException e) {
- }
- }
-
- /**
- * @tests java.lang.Byte#parseByte(String)
- */
- public void test_parseByteLjava_lang_String() {
- assertEquals(0, Byte.parseByte("0"));
- assertEquals(1, Byte.parseByte("1"));
- assertEquals(-1, Byte.parseByte("-1"));
-
- try {
- Byte.parseByte("0x1");
- fail("Expected NumberFormatException with hex string.");
- } catch (NumberFormatException e) {
- }
-
- try {
- Byte.parseByte("9.2");
- fail("Expected NumberFormatException with floating point string.");
- } catch (NumberFormatException e) {
- }
-
- try {
- Byte.parseByte("");
- fail("Expected NumberFormatException with empty string.");
- } catch (NumberFormatException e) {
- }
-
- try {
- Byte.parseByte(null);
- fail("Expected NumberFormatException with null string.");
- } catch (NumberFormatException e) {
- }
- }
-
- /**
- * @tests java.lang.Byte#parseByte(String,int)
- */
- public void test_parseByteLjava_lang_StringI() {
- assertEquals(0, Byte.parseByte("0", 10));
- assertEquals(1, Byte.parseByte("1", 10));
- assertEquals(-1, Byte.parseByte("-1", 10));
-
- //must be consistent with Character.digit()
- assertEquals(Character.digit('1', 2), Byte.parseByte("1", 2));
- assertEquals(Character.digit('F', 16), Byte.parseByte("F", 16));
-
- try {
- Byte.parseByte("0x1", 10);
- fail("Expected NumberFormatException with hex string.");
- } catch (NumberFormatException e) {
- }
-
- try {
- Byte.parseByte("9.2", 10);
- fail("Expected NumberFormatException with floating point string.");
- } catch (NumberFormatException e) {
- }
-
- try {
- Byte.parseByte("", 10);
- fail("Expected NumberFormatException with empty string.");
- } catch (NumberFormatException e) {
- }
-
- try {
- Byte.parseByte(null, 10);
- fail("Expected NumberFormatException with null string.");
- } catch (NumberFormatException e) {
- }
- }
-
- /**
- * @tests java.lang.Byte#decode(String)
- */
- public void test_decodeLjava_lang_String() {
- assertEquals(new Byte((byte) 0), Byte.decode("0"));
- assertEquals(new Byte((byte) 1), Byte.decode("1"));
- assertEquals(new Byte((byte) -1), Byte.decode("-1"));
- assertEquals(new Byte((byte) 0xF), Byte.decode("0xF"));
- assertEquals(new Byte((byte) 0xF), Byte.decode("#F"));
- assertEquals(new Byte((byte) 0xF), Byte.decode("0XF"));
- assertEquals(new Byte((byte) 07), Byte.decode("07"));
-
- try {
- Byte.decode("9.2");
- fail("Expected NumberFormatException with floating point string.");
- } catch (NumberFormatException e) {
- }
-
- try {
- Byte.decode("");
- fail("Expected NumberFormatException with empty string.");
- } catch (NumberFormatException e) {
- }
-
- try {
- Byte.decode(null);
- //undocumented NPE, but seems consistent across JREs
- fail("Expected NullPointerException with null string.");
- } catch (NullPointerException e) {
- }
- }
-
- /**
- * @tests java.lang.Byte#doubleValue()
- */
- public void test_doubleValue() {
- assertEquals(-1D, new Byte((byte) -1).doubleValue(), 0D);
- assertEquals(0D, new Byte((byte) 0).doubleValue(), 0D);
- assertEquals(1D, new Byte((byte) 1).doubleValue(), 0D);
- }
-
- /**
- * @tests java.lang.Byte#floatValue()
- */
- public void test_floatValue() {
- assertEquals(-1F, new Byte((byte) -1).floatValue(), 0F);
- assertEquals(0F, new Byte((byte) 0).floatValue(), 0F);
- assertEquals(1F, new Byte((byte) 1).floatValue(), 0F);
- }
-
- /**
- * @tests java.lang.Byte#intValue()
- */
- public void test_intValue() {
- assertEquals(-1, new Byte((byte) -1).intValue());
- assertEquals(0, new Byte((byte) 0).intValue());
- assertEquals(1, new Byte((byte) 1).intValue());
- }
-
- /**
- * @tests java.lang.Byte#longValue()
- */
- public void test_longValue() {
- assertEquals(-1L, new Byte((byte) -1).longValue());
- assertEquals(0L, new Byte((byte) 0).longValue());
- assertEquals(1L, new Byte((byte) 1).longValue());
- }
-
- /**
- * @tests java.lang.Byte#shortValue()
- */
- public void test_shortValue() {
- assertEquals(-1, new Byte((byte) -1).shortValue());
- assertEquals(0, new Byte((byte) 0).shortValue());
- assertEquals(1, new Byte((byte) 1).shortValue());
- }
-
- /**
- * @tests java.lang.Byte#compareTo(Byte)
- */
- public void test_compareToLjava_lang_Byte() {
- final Byte min = new Byte(Byte.MIN_VALUE);
- final Byte zero = new Byte((byte) 0);
- final Byte max = new Byte(Byte.MAX_VALUE);
-
- assertTrue(max.compareTo(max) == 0);
- assertTrue(min.compareTo(min) == 0);
- assertTrue(zero.compareTo(zero) == 0);
-
- assertTrue(max.compareTo(zero) > 0);
- assertTrue(max.compareTo(min) > 0);
-
- assertTrue(zero.compareTo(max) < 0);
- assertTrue(zero.compareTo(min) > 0);
-
- assertTrue(min.compareTo(zero) < 0);
- assertTrue(min.compareTo(max) < 0);
-
- try {
- min.compareTo(null);
- fail("No NPE");
- } catch (NullPointerException e) {
- }
- }
-
- /**
- * @tests java.lang.Byte#Byte(byte)
- */
- public void test_ConstructorB2() {
- // Test for method java.lang.Byte(byte)
-
- Byte b = new Byte((byte) 127);
- assertTrue("Byte creation failed", b.byteValue() == (byte) 127);
- }
-
- /**
- * @tests java.lang.Byte#Byte(java.lang.String)
- */
- public void test_ConstructorLjava_lang_String2() {
- // Test for method java.lang.Byte(java.lang.String)
-
- Byte b = new Byte("127");
- Byte nb = new Byte("-128");
- assertTrue("Incorrect Byte Object created", b.byteValue() == (byte) 127
- && (nb.byteValue() == (byte) -128));
-
- }
-
- /**
- * @tests java.lang.Byte#byteValue()
- */
- public void test_byteValue() {
- // Test for method byte java.lang.Byte.byteValue()
- assertTrue("Returned incorrect byte value",
- new Byte((byte) 127).byteValue() == (byte) (127));
- }
-
- /**
- * @tests java.lang.Byte#compareTo(java.lang.Byte)
- */
- public void test_compareToLjava_lang_Byte2() {
- // Test for method int java.lang.Byte.compareTo(java.lang.Byte)
- assertTrue("Comparison failed", new Byte((byte) 1).compareTo(new Byte((byte) 2)) < 0);
- assertTrue("Comparison failed", new Byte((byte) 1).compareTo(new Byte((byte) -2)) > 0);
- assertEquals("Comparison failed", 0, new Byte((byte) 1).compareTo(new Byte((byte) 1)));
- }
-
- /**
- * @tests java.lang.Byte#decode(java.lang.String)
- */
- public void test_decodeLjava_lang_String2() {
- // Test for method java.lang.Byte
- // java.lang.Byte.decode(java.lang.String)
- assertTrue("String decoded incorrectly, wanted: 1 got: " + Byte.decode("1").toString(),
- Byte.decode("1").equals(new Byte((byte) 1)));
- assertTrue("String decoded incorrectly, wanted: -1 got: "
- + Byte.decode("-1").toString(), Byte.decode("-1").equals(new Byte((byte) -1)));
- assertTrue("String decoded incorrectly, wanted: 127 got: "
- + Byte.decode("127").toString(), Byte.decode("127")
- .equals(new Byte((byte) 127)));
- assertTrue("String decoded incorrectly, wanted: -128 got: "
- + Byte.decode("-128").toString(), Byte.decode("-128").equals(
- new Byte((byte) -128)));
- assertTrue("String decoded incorrectly, wanted: 127 got: "
- + Byte.decode("0x7f").toString(), Byte.decode("0x7f").equals(
- new Byte((byte) 127)));
- assertTrue("String decoded incorrectly, wanted: -128 got: "
- + Byte.decode("-0x80").toString(), Byte.decode("-0x80").equals(
- new Byte((byte) -128)));
-
- boolean exception = false;
- try {
- Byte.decode("128");
- } catch (NumberFormatException e) {
- // Correct
- exception = true;
- }
- assertTrue("Failed to throw exception for MAX_VALUE + 1", exception);
-
- exception = false;
- try {
- Byte.decode("-129");
- } catch (NumberFormatException e) {
- // Correct
- exception = true;
- }
- assertTrue("Failed to throw exception for MIN_VALUE - 1", exception);
-
- exception = false;
- try {
- Byte.decode("0x80");
- } catch (NumberFormatException e) {
- // Correct
- exception = true;
- }
- assertTrue("Failed to throw exception for hex MAX_VALUE + 1", exception);
-
- exception = false;
- try {
- Byte.decode("-0x81");
- } catch (NumberFormatException e) {
- // Correct
- exception = true;
- }
- assertTrue("Failed to throw exception for hex MIN_VALUE - 1", exception);
- }
-
- /**
- * @tests java.lang.Byte#doubleValue()
- */
- public void test_doubleValue2() {
- assertEquals(127D, new Byte((byte) 127).doubleValue(), 0.0);
- }
-
- /**
- * @tests java.lang.Byte#equals(java.lang.Object)
- */
- public void test_equalsLjava_lang_Object2() {
- // Test for method boolean java.lang.Byte.equals(java.lang.Object)
- Byte b1 = new Byte((byte) 90);
- Byte b2 = new Byte((byte) 90);
- Byte b3 = new Byte((byte) -90);
- assertTrue("Equality test failed", b1.equals(b2));
- assertTrue("Equality test failed", !b1.equals(b3));
- }
-
- /**
- * @tests java.lang.Byte#floatValue()
- */
- public void test_floatValue2() {
- assertEquals(127F, new Byte((byte) 127).floatValue(), 0.0);
- }
-
- /**
- * @tests java.lang.Byte#hashCode()
- */
- public void test_hashCode2() {
- // Test for method int java.lang.Byte.hashCode()
- assertEquals("Incorrect hash returned", 127, new Byte((byte) 127).hashCode());
- }
-
- /**
- * @tests java.lang.Byte#intValue()
- */
- public void test_intValue2() {
- // Test for method int java.lang.Byte.intValue()
- assertEquals("Returned incorrect int value", 127, new Byte((byte) 127).intValue());
- }
-
- /**
- * @tests java.lang.Byte#longValue()
- */
- public void test_longValue2() {
- // Test for method long java.lang.Byte.longValue()
- assertEquals("Returned incorrect long value", 127L, new Byte((byte) 127).longValue());
- }
-
- /**
- * @tests java.lang.Byte#parseByte(java.lang.String)
- */
- public void test_parseByteLjava_lang_String2() {
- assertEquals((byte)127, Byte.parseByte("127"));
- assertEquals((byte)-128, Byte.parseByte("-128"));
- assertEquals((byte)0, Byte.parseByte("0"));
- assertEquals((byte)0x80, Byte.parseByte("-128"));
- assertEquals((byte)0x7F, Byte.parseByte("127"));
-
- try {
- Byte.parseByte("-1000");
- fail("No NumberFormatException");
- } catch (NumberFormatException e) {
- }
-
- try {
- Byte.parseByte("128");
- fail("No NumberFormatException");
- } catch (NumberFormatException e) {
- }
-
- try {
- Byte.parseByte("-129");
- fail("No NumberFormatException");
- } catch (NumberFormatException e) {
- }
- }
-
- /**
- * @tests java.lang.Byte#parseByte(java.lang.String, int)
- */
- public void test_parseByteLjava_lang_StringI2() {
- // Test for method byte java.lang.Byte.parseByte(java.lang.String, int)
- byte b = Byte.parseByte("127", 10);
- byte bn = Byte.parseByte("-128", 10);
- assertTrue("Invalid parse of dec byte", b == (byte) 127 && (bn == (byte) -128));
- assertEquals("Failed to parse hex value", 10, Byte.parseByte("A", 16));
- assertEquals("Returned incorrect value for 0 hex", 0, Byte.parseByte("0", 16));
- assertTrue("Returned incorrect value for most negative value hex", Byte.parseByte(
- "-80", 16) == (byte) 0x80);
- assertTrue("Returned incorrect value for most positive value hex", Byte.parseByte("7f",
- 16) == 0x7f);
- assertEquals("Returned incorrect value for 0 decimal", 0, Byte.parseByte("0", 10));
- assertTrue("Returned incorrect value for most negative value decimal", Byte.parseByte(
- "-128", 10) == (byte) 0x80);
- assertTrue("Returned incorrect value for most positive value decimal", Byte.parseByte(
- "127", 10) == 0x7f);
-
- try {
- Byte.parseByte("-1000", 10);
- fail("Failed to throw exception");
- } catch (NumberFormatException e) {
- }
-
- try {
- Byte.parseByte("128", 10);
- fail("Failed to throw exception for MAX_VALUE + 1");
- } catch (NumberFormatException e) {
- }
-
- try {
- Byte.parseByte("-129", 10);
- fail("Failed to throw exception for MIN_VALUE - 1");
- } catch (NumberFormatException e) {
- }
-
- try {
- Byte.parseByte("80", 16);
- fail("Failed to throw exception for hex MAX_VALUE + 1");
- } catch (NumberFormatException e) {
- }
-
- try {
- Byte.parseByte("-81", 16);
- fail("Failed to throw exception for hex MIN_VALUE + 1");
- } catch (NumberFormatException e) {
- }
- }
-
- /**
- * @tests java.lang.Byte#shortValue()
- */
- public void test_shortValue2() {
- assertEquals((short)127, new Byte((byte)127).shortValue());
- }
-
- /**
- * @tests java.lang.Byte#toString()
- */
- public void test_toString2() {
- assertEquals("Returned incorrect String", "127", new Byte((byte) 127).toString());
- assertEquals("Returned incorrect String", "-127", new Byte((byte) -127).toString());
- assertEquals("Returned incorrect String", "-128", new Byte((byte) -128).toString());
- }
-
- /**
- * @tests java.lang.Byte#toString(byte)
- */
- public void test_toStringB2() {
- assertEquals("Returned incorrect String", "127", Byte.toString((byte) 127));
- assertEquals("Returned incorrect String", "-127", Byte.toString((byte) -127));
- assertEquals("Returned incorrect String", "-128", Byte.toString((byte) -128));
- }
-
- /**
- * @tests java.lang.Byte#valueOf(java.lang.String)
- */
- public void test_valueOfLjava_lang_String2() {
- assertEquals("Returned incorrect byte", 0, Byte.valueOf("0").byteValue());
- assertEquals("Returned incorrect byte", 127, Byte.valueOf("127").byteValue());
- assertEquals("Returned incorrect byte", -127, Byte.valueOf("-127").byteValue());
- assertEquals("Returned incorrect byte", -128, Byte.valueOf("-128").byteValue());
-
- try {
- Byte.valueOf("128");
- fail("Failed to throw exception when passes value > byte");
- } catch (NumberFormatException e) {
- }
- }
-
- /**
- * @tests java.lang.Byte#valueOf(java.lang.String, int)
- */
- public void test_valueOfLjava_lang_StringI2() {
- assertEquals("Returned incorrect byte", 10, Byte.valueOf("A", 16).byteValue());
- assertEquals("Returned incorrect byte", 127, Byte.valueOf("127", 10).byteValue());
- assertEquals("Returned incorrect byte", -127, Byte.valueOf("-127", 10).byteValue());
- assertEquals("Returned incorrect byte", -128, Byte.valueOf("-128", 10).byteValue());
- assertEquals("Returned incorrect byte", 127, Byte.valueOf("7f", 16).byteValue());
- assertEquals("Returned incorrect byte", -127, Byte.valueOf("-7f", 16).byteValue());
- assertEquals("Returned incorrect byte", -128, Byte.valueOf("-80", 16).byteValue());
-
- try {
- Byte.valueOf("128", 10);
- fail("Failed to throw exception when passes value > byte");
- } catch (NumberFormatException e) {
- }
- }
-}
+/* Copyright 2006 The Apache Software Foundation or its licensors, as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.luni.tests.java.lang;
+
+import junit.framework.TestCase;
+
+public class ByteTest extends TestCase {
+
+ /**
+ * @tests java.lang.Byte#valueOf(byte)
+ */
+ public void test_valueOfB() {
+ assertEquals(new Byte(Byte.MIN_VALUE), Byte.valueOf(Byte.MIN_VALUE));
+ assertEquals(new Byte(Byte.MAX_VALUE), Byte.valueOf(Byte.MAX_VALUE));
+ assertEquals(new Byte((byte) 0), Byte.valueOf((byte) 0));
+
+ byte b = Byte.MIN_VALUE + 1;
+ while (b < Byte.MAX_VALUE) {
+ assertEquals(new Byte(b), Byte.valueOf(b));
+ assertSame(Byte.valueOf(b), Byte.valueOf(b));
+ b++;
+ }
+ }
+
+ /**
+ * @tests java.lang.Byte#hashCode()
+ */
+ public void test_hashCode() {
+ assertEquals(1, new Byte((byte) 1).hashCode());
+ assertEquals(2, new Byte((byte) 2).hashCode());
+ assertEquals(0, new Byte((byte) 0).hashCode());
+ assertEquals(-1, new Byte((byte) -1).hashCode());
+ }
+
+ /**
+ * @tests java.lang.Byte#Byte(String)
+ */
+ public void test_ConstructorLjava_lang_String() {
+ assertEquals(new Byte((byte) 0), new Byte("0"));
+ assertEquals(new Byte((byte) 1), new Byte("1"));
+ assertEquals(new Byte((byte) -1), new Byte("-1"));
+
+ try {
+ new Byte("0x1");
+ fail("Expected NumberFormatException with hex string.");
+ } catch (NumberFormatException e) {
+ }
+
+ try {
+ new Byte("9.2");
+ fail("Expected NumberFormatException with floating point string.");
+ } catch (NumberFormatException e) {
+ }
+
+ try {
+ new Byte("");
+ fail("Expected NumberFormatException with empty string.");
+ } catch (NumberFormatException e) {
+ }
+
+ try {
+ new Byte(null);
+ fail("Expected NumberFormatException with null string.");
+ } catch (NumberFormatException e) {
+ }
+ }
+
+ /**
+ * @tests java.lang.Byte#Byte(byte)
+ */
+ public void test_ConstructorB() {
+ assertEquals(1, new Byte((byte) 1).byteValue());
+ assertEquals(2, new Byte((byte) 2).byteValue());
+ assertEquals(0, new Byte((byte) 0).byteValue());
+ assertEquals(-1, new Byte((byte) -1).byteValue());
+ }
+
+ /**
+ * @tests java.lang.Byte#byteValue()
+ */
+ public void test_booleanValue() {
+ assertEquals(1, new Byte((byte) 1).byteValue());
+ assertEquals(2, new Byte((byte) 2).byteValue());
+ assertEquals(0, new Byte((byte) 0).byteValue());
+ assertEquals(-1, new Byte((byte) -1).byteValue());
+ }
+
+ /**
+ * @tests java.lang.Byte#equals(Object)
+ */
+ public void test_equalsLjava_lang_Object() {
+ assertEquals(new Byte((byte) 0), Byte.valueOf((byte) 0));
+ assertEquals(new Byte((byte) 1), Byte.valueOf((byte) 1));
+ assertEquals(new Byte((byte) -1), Byte.valueOf((byte) -1));
+
+ Byte fixture = new Byte((byte) 25);
+ assertEquals(fixture, fixture);
+ assertFalse(fixture.equals(null));
+ assertFalse(fixture.equals("Not a Byte"));
+ }
+
+ /**
+ * @tests java.lang.Byte#toString()
+ */
+ public void test_toString() {
+ assertEquals("-1", new Byte((byte) -1).toString());
+ assertEquals("0", new Byte((byte) 0).toString());
+ assertEquals("1", new Byte((byte) 1).toString());
+ assertEquals("-1", new Byte((byte) 0xFF).toString());
+ }
+
+ /**
+ * @tests java.lang.Byte#toString(byte)
+ */
+ public void test_toStringB() {
+ assertEquals("-1", Byte.toString((byte) -1));
+ assertEquals("0", Byte.toString((byte) 0));
+ assertEquals("1", Byte.toString((byte) 1));
+ assertEquals("-1", Byte.toString((byte) 0xFF));
+ }
+
+ /**
+ * @tests java.lang.Byte#valueOf(String)
+ */
+ public void test_valueOfLjava_lang_String() {
+ assertEquals(new Byte((byte) 0), Byte.valueOf("0"));
+ assertEquals(new Byte((byte) 1), Byte.valueOf("1"));
+ assertEquals(new Byte((byte) -1), Byte.valueOf("-1"));
+
+ try {
+ Byte.valueOf("0x1");
+ fail("Expected NumberFormatException with hex string.");
+ } catch (NumberFormatException e) {
+ }
+
+ try {
+ Byte.valueOf("9.2");
+ fail("Expected NumberFormatException with floating point string.");
+ } catch (NumberFormatException e) {
+ }
+
+ try {
+ Byte.valueOf("");
+ fail("Expected NumberFormatException with empty string.");
+ } catch (NumberFormatException e) {
+ }
+
+ try {
+ Byte.valueOf(null);
+ fail("Expected NumberFormatException with null string.");
+ } catch (NumberFormatException e) {
+ }
+ }
+
+ /**
+ * @tests java.lang.Byte#valueOf(String,int)
+ */
+ public void test_valueOfLjava_lang_StringI() {
+ assertEquals(new Byte((byte) 0), Byte.valueOf("0", 10));
+ assertEquals(new Byte((byte) 1), Byte.valueOf("1", 10));
+ assertEquals(new Byte((byte) -1), Byte.valueOf("-1", 10));
+
+ //must be consistent with Character.digit()
+ assertEquals(Character.digit('1', 2), Byte.valueOf("1", 2).byteValue());
+ assertEquals(Character.digit('F', 16), Byte.valueOf("F", 16).byteValue());
+
+ try {
+ Byte.valueOf("0x1", 10);
+ fail("Expected NumberFormatException with hex string.");
+ } catch (NumberFormatException e) {
+ }
+
+ try {
+ Byte.valueOf("9.2", 10);
+ fail("Expected NumberFormatException with floating point string.");
+ } catch (NumberFormatException e) {
+ }
+
+ try {
+ Byte.valueOf("", 10);
+ fail("Expected NumberFormatException with empty string.");
+ } catch (NumberFormatException e) {
+ }
+
+ try {
+ Byte.valueOf(null, 10);
+ fail("Expected NumberFormatException with null string.");
+ } catch (NumberFormatException e) {
+ }
+ }
+
+ /**
+ * @tests java.lang.Byte#parseByte(String)
+ */
+ public void test_parseByteLjava_lang_String() {
+ assertEquals(0, Byte.parseByte("0"));
+ assertEquals(1, Byte.parseByte("1"));
+ assertEquals(-1, Byte.parseByte("-1"));
+
+ try {
+ Byte.parseByte("0x1");
+ fail("Expected NumberFormatException with hex string.");
+ } catch (NumberFormatException e) {
+ }
+
+ try {
+ Byte.parseByte("9.2");
+ fail("Expected NumberFormatException with floating point string.");
+ } catch (NumberFormatException e) {
+ }
+
+ try {
+ Byte.parseByte("");
+ fail("Expected NumberFormatException with empty string.");
+ } catch (NumberFormatException e) {
+ }
+
+ try {
+ Byte.parseByte(null);
+ fail("Expected NumberFormatException with null string.");
+ } catch (NumberFormatException e) {
+ }
+ }
+
+ /**
+ * @tests java.lang.Byte#parseByte(String,int)
+ */
+ public void test_parseByteLjava_lang_StringI() {
+ assertEquals(0, Byte.parseByte("0", 10));
+ assertEquals(1, Byte.parseByte("1", 10));
+ assertEquals(-1, Byte.parseByte("-1", 10));
+
+ //must be consistent with Character.digit()
+ assertEquals(Character.digit('1', 2), Byte.parseByte("1", 2));
+ assertEquals(Character.digit('F', 16), Byte.parseByte("F", 16));
+
+ try {
+ Byte.parseByte("0x1", 10);
+ fail("Expected NumberFormatException with hex string.");
+ } catch (NumberFormatException e) {
+ }
+
+ try {
+ Byte.parseByte("9.2", 10);
+ fail("Expected NumberFormatException with floating point string.");
+ } catch (NumberFormatException e) {
+ }
+
+ try {
+ Byte.parseByte("", 10);
+ fail("Expected NumberFormatException with empty string.");
+ } catch (NumberFormatException e) {
+ }
+
+ try {
+ Byte.parseByte(null, 10);
+ fail("Expected NumberFormatException with null string.");
+ } catch (NumberFormatException e) {
+ }
+ }
+
+ /**
+ * @tests java.lang.Byte#decode(String)
+ */
+ public void test_decodeLjava_lang_String() {
+ assertEquals(new Byte((byte) 0), Byte.decode("0"));
+ assertEquals(new Byte((byte) 1), Byte.decode("1"));
+ assertEquals(new Byte((byte) -1), Byte.decode("-1"));
+ assertEquals(new Byte((byte) 0xF), Byte.decode("0xF"));
+ assertEquals(new Byte((byte) 0xF), Byte.decode("#F"));
+ assertEquals(new Byte((byte) 0xF), Byte.decode("0XF"));
+ assertEquals(new Byte((byte) 07), Byte.decode("07"));
+
+ try {
+ Byte.decode("9.2");
+ fail("Expected NumberFormatException with floating point string.");
+ } catch (NumberFormatException e) {
+ }
+
+ try {
+ Byte.decode("");
+ fail("Expected NumberFormatException with empty string.");
+ } catch (NumberFormatException e) {
+ }
+
+ try {
+ Byte.decode(null);
+ //undocumented NPE, but seems consistent across JREs
+ fail("Expected NullPointerException with null string.");
+ } catch (NullPointerException e) {
+ }
+ }
+
+ /**
+ * @tests java.lang.Byte#doubleValue()
+ */
+ public void test_doubleValue() {
+ assertEquals(-1D, new Byte((byte) -1).doubleValue(), 0D);
+ assertEquals(0D, new Byte((byte) 0).doubleValue(), 0D);
+ assertEquals(1D, new Byte((byte) 1).doubleValue(), 0D);
+ }
+
+ /**
+ * @tests java.lang.Byte#floatValue()
+ */
+ public void test_floatValue() {
+ assertEquals(-1F, new Byte((byte) -1).floatValue(), 0F);
+ assertEquals(0F, new Byte((byte) 0).floatValue(), 0F);
+ assertEquals(1F, new Byte((byte) 1).floatValue(), 0F);
+ }
+
+ /**
+ * @tests java.lang.Byte#intValue()
+ */
+ public void test_intValue() {
+ assertEquals(-1, new Byte((byte) -1).intValue());
+ assertEquals(0, new Byte((byte) 0).intValue());
+ assertEquals(1, new Byte((byte) 1).intValue());
+ }
+
+ /**
+ * @tests java.lang.Byte#longValue()
+ */
+ public void test_longValue() {
+ assertEquals(-1L, new Byte((byte) -1).longValue());
+ assertEquals(0L, new Byte((byte) 0).longValue());
+ assertEquals(1L, new Byte((byte) 1).longValue());
+ }
+
+ /**
+ * @tests java.lang.Byte#shortValue()
+ */
+ public void test_shortValue() {
+ assertEquals(-1, new Byte((byte) -1).shortValue());
+ assertEquals(0, new Byte((byte) 0).shortValue());
+ assertEquals(1, new Byte((byte) 1).shortValue());
+ }
+
+ /**
+ * @tests java.lang.Byte#compareTo(Byte)
+ */
+ public void test_compareToLjava_lang_Byte() {
+ final Byte min = new Byte(Byte.MIN_VALUE);
+ final Byte zero = new Byte((byte) 0);
+ final Byte max = new Byte(Byte.MAX_VALUE);
+
+ assertTrue(max.compareTo(max) == 0);
+ assertTrue(min.compareTo(min) == 0);
+ assertTrue(zero.compareTo(zero) == 0);
+
+ assertTrue(max.compareTo(zero) > 0);
+ assertTrue(max.compareTo(min) > 0);
+
+ assertTrue(zero.compareTo(max) < 0);
+ assertTrue(zero.compareTo(min) > 0);
+
+ assertTrue(min.compareTo(zero) < 0);
+ assertTrue(min.compareTo(max) < 0);
+
+ try {
+ min.compareTo(null);
+ fail("No NPE");
+ } catch (NullPointerException e) {
+ }
+ }
+
+ /**
+ * @tests java.lang.Byte#Byte(byte)
+ */
+ public void test_ConstructorB2() {
+ // Test for method java.lang.Byte(byte)
+
+ Byte b = new Byte((byte) 127);
+ assertTrue("Byte creation failed", b.byteValue() == (byte) 127);
+ }
+
+ /**
+ * @tests java.lang.Byte#Byte(java.lang.String)
+ */
+ public void test_ConstructorLjava_lang_String2() {
+ // Test for method java.lang.Byte(java.lang.String)
+
+ Byte b = new Byte("127");
+ Byte nb = new Byte("-128");
+ assertTrue("Incorrect Byte Object created", b.byteValue() == (byte) 127
+ && (nb.byteValue() == (byte) -128));
+
+ }
+
+ /**
+ * @tests java.lang.Byte#byteValue()
+ */
+ public void test_byteValue() {
+ // Test for method byte java.lang.Byte.byteValue()
+ assertTrue("Returned incorrect byte value",
+ new Byte((byte) 127).byteValue() == (byte) (127));
+ }
+
+ /**
+ * @tests java.lang.Byte#compareTo(java.lang.Byte)
+ */
+ public void test_compareToLjava_lang_Byte2() {
+ // Test for method int java.lang.Byte.compareTo(java.lang.Byte)
+ assertTrue("Comparison failed", new Byte((byte) 1).compareTo(new Byte((byte) 2)) < 0);
+ assertTrue("Comparison failed", new Byte((byte) 1).compareTo(new Byte((byte) -2)) > 0);
+ assertEquals("Comparison failed", 0, new Byte((byte) 1).compareTo(new Byte((byte) 1)));
+ }
+
+ /**
+ * @tests java.lang.Byte#decode(java.lang.String)
+ */
+ public void test_decodeLjava_lang_String2() {
+ // Test for method java.lang.Byte
+ // java.lang.Byte.decode(java.lang.String)
+ assertTrue("String decoded incorrectly, wanted: 1 got: " + Byte.decode("1").toString(),
+ Byte.decode("1").equals(new Byte((byte) 1)));
+ assertTrue("String decoded incorrectly, wanted: -1 got: "
+ + Byte.decode("-1").toString(), Byte.decode("-1").equals(new Byte((byte) -1)));
+ assertTrue("String decoded incorrectly, wanted: 127 got: "
+ + Byte.decode("127").toString(), Byte.decode("127")
+ .equals(new Byte((byte) 127)));
+ assertTrue("String decoded incorrectly, wanted: -128 got: "
+ + Byte.decode("-128").toString(), Byte.decode("-128").equals(
+ new Byte((byte) -128)));
+ assertTrue("String decoded incorrectly, wanted: 127 got: "
+ + Byte.decode("0x7f").toString(), Byte.decode("0x7f").equals(
+ new Byte((byte) 127)));
+ assertTrue("String decoded incorrectly, wanted: -128 got: "
+ + Byte.decode("-0x80").toString(), Byte.decode("-0x80").equals(
+ new Byte((byte) -128)));
+
+ boolean exception = false;
+ try {
+ Byte.decode("128");
+ } catch (NumberFormatException e) {
+ // Correct
+ exception = true;
+ }
+ assertTrue("Failed to throw exception for MAX_VALUE + 1", exception);
+
+ exception = false;
+ try {
+ Byte.decode("-129");
+ } catch (NumberFormatException e) {
+ // Correct
+ exception = true;
+ }
+ assertTrue("Failed to throw exception for MIN_VALUE - 1", exception);
+
+ exception = false;
+ try {
+ Byte.decode("0x80");
+ } catch (NumberFormatException e) {
+ // Correct
+ exception = true;
+ }
+ assertTrue("Failed to throw exception for hex MAX_VALUE + 1", exception);
+
+ exception = false;
+ try {
+ Byte.decode("-0x81");
+ } catch (NumberFormatException e) {
+ // Correct
+ exception = true;
+ }
+ assertTrue("Failed to throw exception for hex MIN_VALUE - 1", exception);
+ }
+
+ /**
+ * @tests java.lang.Byte#doubleValue()
+ */
+ public void test_doubleValue2() {
+ assertEquals(127D, new Byte((byte) 127).doubleValue(), 0.0);
+ }
+
+ /**
+ * @tests java.lang.Byte#equals(java.lang.Object)
+ */
+ public void test_equalsLjava_lang_Object2() {
+ // Test for method boolean java.lang.Byte.equals(java.lang.Object)
+ Byte b1 = new Byte((byte) 90);
+ Byte b2 = new Byte((byte) 90);
+ Byte b3 = new Byte((byte) -90);
+ assertTrue("Equality test failed", b1.equals(b2));
+ assertTrue("Equality test failed", !b1.equals(b3));
+ }
+
+ /**
+ * @tests java.lang.Byte#floatValue()
+ */
+ public void test_floatValue2() {
+ assertEquals(127F, new Byte((byte) 127).floatValue(), 0.0);
+ }
+
+ /**
+ * @tests java.lang.Byte#hashCode()
+ */
+ public void test_hashCode2() {
+ // Test for method int java.lang.Byte.hashCode()
+ assertEquals("Incorrect hash returned", 127, new Byte((byte) 127).hashCode());
+ }
+
+ /**
+ * @tests java.lang.Byte#intValue()
+ */
+ public void test_intValue2() {
+ // Test for method int java.lang.Byte.intValue()
+ assertEquals("Returned incorrect int value", 127, new Byte((byte) 127).intValue());
+ }
+
+ /**
+ * @tests java.lang.Byte#longValue()
+ */
+ public void test_longValue2() {
+ // Test for method long java.lang.Byte.longValue()
+ assertEquals("Returned incorrect long value", 127L, new Byte((byte) 127).longValue());
+ }
+
+ /**
+ * @tests java.lang.Byte#parseByte(java.lang.String)
+ */
+ public void test_parseByteLjava_lang_String2() {
+ assertEquals((byte)127, Byte.parseByte("127"));
+ assertEquals((byte)-128, Byte.parseByte("-128"));
+ assertEquals((byte)0, Byte.parseByte("0"));
+ assertEquals((byte)0x80, Byte.parseByte("-128"));
+ assertEquals((byte)0x7F, Byte.parseByte("127"));
+
+ try {
+ Byte.parseByte("-1000");
+ fail("No NumberFormatException");
+ } catch (NumberFormatException e) {
+ }
+
+ try {
+ Byte.parseByte("128");
+ fail("No NumberFormatException");
+ } catch (NumberFormatException e) {
+ }
+
+ try {
+ Byte.parseByte("-129");
+ fail("No NumberFormatException");
+ } catch (NumberFormatException e) {
+ }
+ }
+
+ /**
+ * @tests java.lang.Byte#parseByte(java.lang.String, int)
+ */
+ public void test_parseByteLjava_lang_StringI2() {
+ // Test for method byte java.lang.Byte.parseByte(java.lang.String, int)
+ byte b = Byte.parseByte("127", 10);
+ byte bn = Byte.parseByte("-128", 10);
+ assertTrue("Invalid parse of dec byte", b == (byte) 127 && (bn == (byte) -128));
+ assertEquals("Failed to parse hex value", 10, Byte.parseByte("A", 16));
+ assertEquals("Returned incorrect value for 0 hex", 0, Byte.parseByte("0", 16));
+ assertTrue("Returned incorrect value for most negative value hex", Byte.parseByte(
+ "-80", 16) == (byte) 0x80);
+ assertTrue("Returned incorrect value for most positive value hex", Byte.parseByte("7f",
+ 16) == 0x7f);
+ assertEquals("Returned incorrect value for 0 decimal", 0, Byte.parseByte("0", 10));
+ assertTrue("Returned incorrect value for most negative value decimal", Byte.parseByte(
+ "-128", 10) == (byte) 0x80);
+ assertTrue("Returned incorrect value for most positive value decimal", Byte.parseByte(
+ "127", 10) == 0x7f);
+
+ try {
+ Byte.parseByte("-1000", 10);
+ fail("Failed to throw exception");
+ } catch (NumberFormatException e) {
+ }
+
+ try {
+ Byte.parseByte("128", 10);
+ fail("Failed to throw exception for MAX_VALUE + 1");
+ } catch (NumberFormatException e) {
+ }
+
+ try {
+ Byte.parseByte("-129", 10);
+ fail("Failed to throw exception for MIN_VALUE - 1");
+ } catch (NumberFormatException e) {
+ }
+
+ try {
+ Byte.parseByte("80", 16);
+ fail("Failed to throw exception for hex MAX_VALUE + 1");
+ } catch (NumberFormatException e) {
+ }
+
+ try {
+ Byte.parseByte("-81", 16);
+ fail("Failed to throw exception for hex MIN_VALUE + 1");
+ } catch (NumberFormatException e) {
+ }
+ }
+
+ /**
+ * @tests java.lang.Byte#shortValue()
+ */
+ public void test_shortValue2() {
+ assertEquals((short)127, new Byte((byte)127).shortValue());
+ }
+
+ /**
+ * @tests java.lang.Byte#toString()
+ */
+ public void test_toString2() {
+ assertEquals("Returned incorrect String", "127", new Byte((byte) 127).toString());
+ assertEquals("Returned incorrect String", "-127", new Byte((byte) -127).toString());
+ assertEquals("Returned incorrect String", "-128", new Byte((byte) -128).toString());
+ }
+
+ /**
+ * @tests java.lang.Byte#toString(byte)
+ */
+ public void test_toStringB2() {
+ assertEquals("Returned incorrect String", "127", Byte.toString((byte) 127));
+ assertEquals("Returned incorrect String", "-127", Byte.toString((byte) -127));
+ assertEquals("Returned incorrect String", "-128", Byte.toString((byte) -128));
+ }
+
+ /**
+ * @tests java.lang.Byte#valueOf(java.lang.String)
+ */
+ public void test_valueOfLjava_lang_String2() {
+ assertEquals("Returned incorrect byte", 0, Byte.valueOf("0").byteValue());
+ assertEquals("Returned incorrect byte", 127, Byte.valueOf("127").byteValue());
+ assertEquals("Returned incorrect byte", -127, Byte.valueOf("-127").byteValue());
+ assertEquals("Returned incorrect byte", -128, Byte.valueOf("-128").byteValue());
+
+ try {
+ Byte.valueOf("128");
+ fail("Failed to throw exception when passes value > byte");
+ } catch (NumberFormatException e) {
+ }
+ }
+
+ /**
+ * @tests java.lang.Byte#valueOf(java.lang.String, int)
+ */
+ public void test_valueOfLjava_lang_StringI2() {
+ assertEquals("Returned incorrect byte", 10, Byte.valueOf("A", 16).byteValue());
+ assertEquals("Returned incorrect byte", 127, Byte.valueOf("127", 10).byteValue());
+ assertEquals("Returned incorrect byte", -127, Byte.valueOf("-127", 10).byteValue());
+ assertEquals("Returned incorrect byte", -128, Byte.valueOf("-128", 10).byteValue());
+ assertEquals("Returned incorrect byte", 127, Byte.valueOf("7f", 16).byteValue());
+ assertEquals("Returned incorrect byte", -127, Byte.valueOf("-7f", 16).byteValue());
+ assertEquals("Returned incorrect byte", -128, Byte.valueOf("-80", 16).byteValue());
+
+ try {
+ Byte.valueOf("128", 10);
+ fail("Failed to throw exception when passes value > byte");
+ } catch (NumberFormatException e) {
+ }
+ }
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/ByteTest.java
------------------------------------------------------------------------------
svn:eol-style = native