summaryrefslogtreecommitdiffstats
path: root/nio_char/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'nio_char/src/test/java')
-rw-r--r--nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/ASCIICharsetEncoderTest.java160
-rw-r--r--nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/AllTests.java1
-rw-r--r--nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharacterCodingExceptionTest.java33
-rw-r--r--nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharsetDecoderTest.java49
-rw-r--r--nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharsetEncoderTest.java46
-rw-r--r--nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharsetTest.java61
-rw-r--r--nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CoderMalfunctionErrorTest.java42
-rw-r--r--nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/IllegalCharsetNameExceptionTest.java37
-rw-r--r--nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/MalformedInputExceptionTest.java39
-rw-r--r--nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/UnmappableCharacterExceptionTest.java39
-rw-r--r--nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/UnsupportedCharsetExceptionTest.java37
-rw-r--r--nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/spi/CharsetProviderTest.java16
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/ASCCharsetDecoderTest.java3
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/ASCCharsetTest.java24
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/AbstractCharsetTestCase.java79
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/AllTests.java70
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/CharsetDecoderTest.java239
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/CharsetEncoderTest.java340
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/CharsetProviderTest.java56
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/CharsetTest.java523
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/CoderResultTest.java175
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/CodingErrorActionTest.java25
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/GBCharsetDecoderTest.java3
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/GBCharsetEncoderTest.java36
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/ISOCharsetDecoderTest.java3
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/ISOCharsetEncoderTest.java63
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/ISOCharsetTest.java24
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/UTF16BECharsetDecoderTest.java4
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/UTF16BECharsetEncoderTest.java60
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/UTF16BECharsetTest.java24
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/UTF16CharsetDecoderTest.java27
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/UTF16CharsetEncoderTest.java66
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/UTF16CharsetTest.java24
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/UTF16LECharsetDecoderTest.java6
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/UTF16LECharsetEncoderTest.java63
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/UTF16LECharsetTest.java25
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/UTF8CharsetTest.java24
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/UTFCharsetDecoderTest.java3
-rw-r--r--nio_char/src/test/java/tests/api/java/nio/charset/UTFCharsetEncoderTest.java45
39 files changed, 2542 insertions, 52 deletions
diff --git a/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/ASCIICharsetEncoderTest.java b/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/ASCIICharsetEncoderTest.java
index 01385f2..f704e3b 100644
--- a/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/ASCIICharsetEncoderTest.java
+++ b/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/ASCIICharsetEncoderTest.java
@@ -16,6 +16,11 @@
package org.apache.harmony.nio_char.tests.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.CharacterCodingException;
@@ -27,7 +32,7 @@ import java.nio.charset.MalformedInputException;
import java.nio.charset.UnmappableCharacterException;
import junit.framework.TestCase;
-
+@TestTargetClass(CharsetEncoder.class)
public class ASCIICharsetEncoderTest extends TestCase {
// charset for ascii
@@ -46,6 +51,15 @@ public class ASCIICharsetEncoderTest extends TestCase {
protected void tearDown() throws Exception {
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {java.lang.CharSequence.class}
+ )
+ })
public void testCanEncodeCharSequence() {
// normal case for ascCS
assertTrue(encoder.canEncode("\u0077"));
@@ -58,21 +72,66 @@ public class ASCIICharsetEncoderTest extends TestCase {
assertTrue(encoder.canEncode(""));
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {java.lang.CharSequence.class}
+ ),@TestTarget(
+ methodName = "canEncode",
+ methodArgs = {char.class}
+ )
+ })
public void testCanEncodeSurrogate () {
assertFalse(encoder.canEncode('\ud800'));
assertFalse(encoder.canEncode("\udc00"));
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {char.class}
+ )
+ })
public void testCanEncodechar() throws CharacterCodingException {
assertTrue(encoder.canEncode('\u0077'));
assertFalse(encoder.canEncode('\uc2a3'));
}
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "averageBytesPerChar",
+ methodArgs = {}
+ ),@TestTarget(
+ methodName = "maxBytesPerChar",
+ methodArgs = {}
+ )
+ })
public void testSpecificDefaultValue() {
assertEquals(1.0, encoder.averageBytesPerChar(), 0.0);
assertEquals(1.0, encoder.maxBytesPerChar(), 0.0);
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class, java.nio.ByteBuffer.class, boolean.class}
+ ),@TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class}
+ )
+ })
public void testMultiStepEncode() throws CharacterCodingException {
encoder.onMalformedInput(CodingErrorAction.REPORT);
encoder.onUnmappableCharacter(CodingErrorAction.REPORT);
@@ -94,6 +153,15 @@ public class ASCIICharsetEncoderTest extends TestCase {
.isMalformed());
}
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class}
+ )
+ })
public void testEncodeMapping() throws CharacterCodingException {
encoder.reset();
@@ -129,6 +197,21 @@ public class ASCIICharsetEncoderTest extends TestCase {
}
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Checks functionality. Exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class, java.nio.ByteBuffer.class, boolean.class}
+ ), @TestTarget(
+ methodName = "flush",
+ methodArgs = {java.nio.ByteBuffer.class}
+ ), @TestTarget(
+ methodName = "reset",
+ methodArgs = {}
+ )
+ })
public void testInternalState() {
CharBuffer in = CharBuffer.wrap("A");
ByteBuffer out = ByteBuffer.allocate(0x10);
@@ -142,6 +225,21 @@ public class ASCIICharsetEncoderTest extends TestCase {
}
//reset could be called at any time
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Checks functionality. Exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "reset",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class, java.nio.ByteBuffer.class, boolean.class}
+ ), @TestTarget(
+ methodName = "flush",
+ methodArgs = {java.nio.ByteBuffer.class}
+ )
+ })
public void testInternalState_Reset() {
CharsetEncoder newEncoder = cs.newEncoder();
//Init - > reset
@@ -175,6 +273,15 @@ public class ASCIICharsetEncoderTest extends TestCase {
}
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "CoderMalfunctionError checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class, java.nio.ByteBuffer.class, boolean.class}
+ )
+ })
public void testInternalState_Encoding() {
CharsetEncoder newEncoder = cs.newEncoder();
//Init - > encoding
@@ -232,6 +339,15 @@ public class ASCIICharsetEncoderTest extends TestCase {
}
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "CoderMalfunctionError checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class, java.nio.ByteBuffer.class, boolean.class}
+ )
+ })
public void testInternalState_Encoding_END() {
CharsetEncoder newEncoder = cs.newEncoder();
@@ -287,6 +403,15 @@ public class ASCIICharsetEncoderTest extends TestCase {
}
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "CoderMalfunctionError checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class, java.nio.ByteBuffer.class, boolean.class}
+ )
+ })
public void testInternalState_Flushed() {
CharsetEncoder newEncoder = cs.newEncoder();
@@ -346,6 +471,21 @@ public class ASCIICharsetEncoderTest extends TestCase {
}
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Functional test.",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class}
+ ), @TestTarget(
+ methodName = "flush",
+ methodArgs = {java.nio.ByteBuffer.class}
+ ), @TestTarget(
+ methodName = "reset",
+ methodArgs = {}
+ )
+ })
public void testInternalState_Encode() throws CharacterCodingException {
CharsetEncoder newEncoder = cs.newEncoder();
//Init - > encode
@@ -393,6 +533,24 @@ public class ASCIICharsetEncoderTest extends TestCase {
}
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "CoderMalfunctionError checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class}
+ ), @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class, java.nio.ByteBuffer.class, boolean.class}
+ ), @TestTarget(
+ methodName = "flush",
+ methodArgs = {java.nio.ByteBuffer.class}
+ ), @TestTarget(
+ methodName = "reset",
+ methodArgs = {}
+ )
+ })
public void testInternalState_from_Encode() throws CharacterCodingException {
CharsetEncoder newEncoder = cs.newEncoder();
diff --git a/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/AllTests.java b/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/AllTests.java
index 8dd485c..c8f063e 100644
--- a/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/AllTests.java
+++ b/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/AllTests.java
@@ -29,6 +29,7 @@ public class AllTests {
TestSuite suite = new TestSuite(
"Test for org.apache.harmony.nio_char.tests.java.nio.charset");
//$JUnit-BEGIN$
+ suite.addTestSuite(ASCIICharsetEncoderTest.class);
suite.addTestSuite(CharacterCodingExceptionTest.class);
suite.addTestSuite(CharsetEncoderTest.class);
suite.addTestSuite(CharsetTest.class);
diff --git a/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharacterCodingExceptionTest.java b/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharacterCodingExceptionTest.java
index f1bab63..1fbeace 100644
--- a/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharacterCodingExceptionTest.java
+++ b/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharacterCodingExceptionTest.java
@@ -16,6 +16,11 @@
package org.apache.harmony.nio_char.tests.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
import java.io.IOException;
import java.nio.charset.CharacterCodingException;
@@ -23,11 +28,21 @@ import junit.framework.TestCase;
import org.apache.harmony.testframework.serialization.SerializationTest;
+@TestTargetClass(CharacterCodingException.class)
/**
* Test CharacterCodingException
*/
public class CharacterCodingExceptionTest extends TestCase {
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "CharacterCodingException",
+ methodArgs = {}
+ )
+ })
public void testConstructor() {
CharacterCodingException ex = new CharacterCodingException();
assertTrue(ex instanceof IOException);
@@ -38,6 +53,15 @@ public class CharacterCodingExceptionTest extends TestCase {
/**
* @tests serialization/deserialization compatibility.
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "Verifies serialization.",
+ targets = {
+ @TestTarget(
+ methodName = "!SerializationSelf",
+ methodArgs = {}
+ )
+ })
public void testSerializationSelf() throws Exception {
SerializationTest.verifySelf(new CharacterCodingException());
@@ -46,6 +70,15 @@ public class CharacterCodingExceptionTest extends TestCase {
/**
* @tests serialization/deserialization compatibility with RI.
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "Verifies serialization.",
+ targets = {
+ @TestTarget(
+ methodName = "!SerializationGolden",
+ methodArgs = {}
+ )
+ })
public void testSerializationCompatibility() throws Exception {
SerializationTest.verifyGolden(this, new CharacterCodingException());
diff --git a/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharsetDecoderTest.java b/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharsetDecoderTest.java
index 8617669..ec89ed5 100644
--- a/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharsetDecoderTest.java
+++ b/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharsetDecoderTest.java
@@ -16,6 +16,11 @@
package org.apache.harmony.nio_char.tests.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
@@ -29,13 +34,22 @@ import java.nio.charset.CodingErrorAction;
import java.nio.charset.MalformedInputException;
import junit.framework.TestCase;
-
+@TestTargetClass(CharsetDecoder.class)
public class CharsetDecoderTest extends TestCase {
/**
* @tests java.nio.charset.CharsetDecoder.CharsetDecoder(Charset, float,
* float)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Checks IllegalArgumentException.",
+ targets = {
+ @TestTarget(
+ methodName = "CharsetDecoder",
+ methodArgs = {java.nio.charset.Charset.class, float.class, float.class}
+ )
+ })
public void test_ConstructorLjava_nio_charset_CharsetFF() {
// Regression for HARMONY-142
try {
@@ -64,6 +78,15 @@ public class CharsetDecoderTest extends TestCase {
/**
* @tests java.nio.charset.CharsetDecoder#decode(java.nio.ByteBuffer)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Regression test.",
+ targets = {
+ @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class}
+ )
+ })
public void test_decode() throws CharacterCodingException {
// Regression for HARMONY-33
// ByteBuffer bb = ByteBuffer.allocate(1);
@@ -101,6 +124,15 @@ public class CharsetDecoderTest extends TestCase {
/*
* Test malfunction decode(ByteBuffer)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Regression test. Checks CoderMalfunctionError",
+ targets = {
+ @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class}
+ )
+ })
public void test_decodeLjava_nio_ByteBuffer() throws Exception {
MockMalfunctionCharset cs1 = new MockMalfunctionCharset(
"Harmony-124-1", null); //$NON-NLS-1$
@@ -176,6 +208,21 @@ public class CharsetDecoderTest extends TestCase {
/*
* Test the method decode(ByteBuffer) .
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Functional test.",
+ targets = {
+ @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class, java.nio.CharBuffer.class, boolean.class}
+ ),@TestTarget(
+ methodName = "implOnMalformedInput",
+ methodArgs = {java.nio.charset.CodingErrorAction.class}
+ ),@TestTarget(
+ methodName = "replaceWith",
+ methodArgs = {java.lang.String.class}
+ )
+ })
public void testDecodeLjava_nio_ByteBuffer_ReplaceOverflow()
throws Exception {
String replaceString = "a";
diff --git a/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharsetEncoderTest.java b/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharsetEncoderTest.java
index fce2a1a..104b993 100644
--- a/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharsetEncoderTest.java
+++ b/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharsetEncoderTest.java
@@ -16,6 +16,11 @@
package org.apache.harmony.nio_char.tests.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
@@ -26,13 +31,25 @@ import java.nio.charset.CoderMalfunctionError;
import java.nio.charset.CoderResult;
import junit.framework.TestCase;
-
+@TestTargetClass(CharsetEncoder.class)
public class CharsetEncoderTest extends TestCase {
/**
* @tests java.nio.charset.CharsetEncoder.CharsetEncoder(
* java.nio.charset.Charset, float, float)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "Checks IllegalArgumentException",
+ targets = {
+ @TestTarget(
+ methodName = "CharsetEncoder",
+ methodArgs = {java.nio.charset.Charset.class, float.class, float.class}
+ ), @TestTarget(
+ methodName = "CharsetEncoder",
+ methodArgs = {java.nio.charset.Charset.class, float.class, float.class, byte[].class}
+ )
+ })
public void test_ConstructorLjava_nio_charset_CharsetFF() {
// Regression for HARMONY-141
try {
@@ -57,6 +74,15 @@ public class CharsetEncoderTest extends TestCase {
* @tests java.nio.charset.CharsetEncoder.CharsetEncoder(
* java.nio.charset.Charset, float, float)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "CharsetEncoder",
+ methodArgs = {java.nio.charset.Charset.class, float.class, float.class}
+ )
+ })
public void test_ConstructorLjava_nio_charset_CharsetNull() {
// Regression for HARMONY-491
CharsetEncoder ech = new MockCharsetEncoderForHarmony491(null, 1, 1);
@@ -104,6 +130,15 @@ public class CharsetEncoderTest extends TestCase {
/*
* Test malfunction encode(CharBuffer)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Regression test checks CoderMalfunctionError",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class}
+ )
+ })
public void test_EncodeLjava_nio_CharBuffer() throws Exception {
MockMalfunctionCharset cs = new MockMalfunctionCharset("mock", null);
try {
@@ -153,6 +188,15 @@ public class CharsetEncoderTest extends TestCase {
/*
* Test reserve bytes encode(CharBuffer,ByteBuffer,boolean)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Functional test.",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class, java.nio.ByteBuffer.class, boolean.class}
+ )
+ })
public void test_EncodeLjava_nio_CharBufferLjava_nio_ByteBufferB() {
CharsetEncoder encoder = Charset.forName("utf-8").newEncoder();
CharBuffer in1 = CharBuffer.wrap("\ud800");
diff --git a/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharsetTest.java b/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharsetTest.java
index 0c46cd9..c912469 100644
--- a/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharsetTest.java
+++ b/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CharsetTest.java
@@ -16,6 +16,11 @@
package org.apache.harmony.nio_char.tests.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
@@ -29,7 +34,7 @@ import java.util.Properties;
import java.util.Set;
import junit.framework.TestCase;
-
+@TestTargetClass(Charset.class)
public class CharsetTest extends TestCase {
// Will contain names of charsets registered with IANA
@@ -56,6 +61,15 @@ public class CharsetTest extends TestCase {
/**
* @tests java.nio.charset.Charset#isRegistered()
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "isRegistered",
+ methodArgs = {}
+ )
+ })
public void test_isRegistered() {
// Regression for HARMONY-45
for (Iterator nameItr = knownRegisteredCharsets.iterator(); nameItr.hasNext();) {
@@ -73,6 +87,15 @@ public class CharsetTest extends TestCase {
/**
* @tests java.nio.charset.Charset#isSupported(String)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Checks IllegalCharsetNameException",
+ targets = {
+ @TestTarget(
+ methodName = "isSupported",
+ methodArgs = {java.lang.String.class}
+ )
+ })
public void testIsSupported_EmptyString() {
// Regression for HARMONY-113
try {
@@ -86,6 +109,15 @@ public class CharsetTest extends TestCase {
/**
* @tests java.nio.charset.Charset#defaultCharset()
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "defaultCharset",
+ methodArgs = {}
+ )
+ })
public void test_defaultCharset() {
String charsetName = null;
String defaultCharsetName = null;
@@ -135,6 +167,15 @@ public class CharsetTest extends TestCase {
/**
* @tests java.nio.charset.Charset#forName(java.lang.String)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "forName",
+ methodArgs = {java.lang.String.class}
+ )
+ })
public void test_forNameLjava_lang_String() {
/*
* invoke forName two times with the same canonical name, it
@@ -156,6 +197,15 @@ public class CharsetTest extends TestCase {
/*
* test cached decoder
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Functional test.",
+ targets = {
+ @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class}
+ )
+ })
public void test_DecodeLjava_nio_ByteBuffer() throws Exception{
MockCharsetForDecoder cs1 = new MockCharsetForDecoder("CachedCharset",null);
MockCharsetForDecoder cs2 = new MockCharsetForDecoder("CachedCharset",null);
@@ -218,6 +268,15 @@ public class CharsetTest extends TestCase {
/*
* test cached encoder
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Functional test.",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class}
+ )
+ })
public void test_EncodeLjava_nio_CharBuffer() throws Exception {
MockCharsetForEncoder cs1 = new MockCharsetForEncoder("CachedCharset", null);
MockCharsetForEncoder cs2 = new MockCharsetForEncoder("CachedCharset", null);
diff --git a/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CoderMalfunctionErrorTest.java b/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CoderMalfunctionErrorTest.java
index dc9f269..eefad63 100644
--- a/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CoderMalfunctionErrorTest.java
+++ b/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/CoderMalfunctionErrorTest.java
@@ -16,12 +16,18 @@
package org.apache.harmony.nio_char.tests.java.nio.charset;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestLevel;
+
import java.nio.charset.CoderMalfunctionError;
import junit.framework.TestCase;
import org.apache.harmony.testframework.serialization.SerializationTest;
+@TestTargetClass(CoderMalfunctionError.class)
/**
* Test java.nio.CoderMalfunctionError.
*/
@@ -30,6 +36,15 @@ public class CoderMalfunctionErrorTest extends TestCase {
/*
* Test constructor with normal param.
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "CoderMalfunctionError",
+ methodArgs = {java.lang.Exception.class}
+ )
+ })
public void testConstructor_Normal() {
Exception ex = new Exception();
CoderMalfunctionError e = new CoderMalfunctionError(ex);
@@ -39,6 +54,15 @@ public class CoderMalfunctionErrorTest extends TestCase {
/*
* Test constructor with null param.
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "CoderMalfunctionError",
+ methodArgs = {java.lang.Exception.class}
+ )
+ })
public void testConstructor_Null() {
CoderMalfunctionError e = new CoderMalfunctionError(null);
assertNull(e.getCause());
@@ -47,6 +71,15 @@ public class CoderMalfunctionErrorTest extends TestCase {
/**
* @tests serialization/deserialization compatibility.
*/
+ @TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "Verifies serialization.",
+ targets = {
+ @TestTarget(
+ methodName = "!SerializationSelf",
+ methodArgs = {}
+ )
+ })
public void testSerializationSelf() throws Exception {
SerializationTest.verifySelf(new CoderMalfunctionError(null));
@@ -55,6 +88,15 @@ public class CoderMalfunctionErrorTest extends TestCase {
/**
* @tests serialization/deserialization compatibility with RI.
*/
+ @TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "Verifies serialization.",
+ targets = {
+ @TestTarget(
+ methodName = "!SerializationGolden",
+ methodArgs = {}
+ )
+ })
public void testSerializationCompatibility() throws Exception {
SerializationTest.verifyGolden(this, new CoderMalfunctionError(null));
diff --git a/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/IllegalCharsetNameExceptionTest.java b/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/IllegalCharsetNameExceptionTest.java
index 914eea2..61bdc81 100644
--- a/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/IllegalCharsetNameExceptionTest.java
+++ b/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/IllegalCharsetNameExceptionTest.java
@@ -16,6 +16,11 @@
package org.apache.harmony.nio_char.tests.java.nio.charset;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestLevel;
+
import java.io.Serializable;
import java.nio.charset.IllegalCharsetNameException;
@@ -24,11 +29,25 @@ import junit.framework.TestCase;
import org.apache.harmony.testframework.serialization.SerializationTest;
import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
+@TestTargetClass(IllegalCharsetNameException.class)
/**
* Test class IllegalCharsetNameException.
*/
public class IllegalCharsetNameExceptionTest extends TestCase {
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "IllegalCharsetNameException",
+ methodArgs = {java.lang.String.class}
+ ),@TestTarget(
+ methodName = "getCharsetName",
+ methodArgs = {}
+ )
+
+ })
public void testConstructor() {
IllegalCharsetNameException ex = new IllegalCharsetNameException(
"impossible");
@@ -77,6 +96,15 @@ public class IllegalCharsetNameExceptionTest extends TestCase {
/**
* @tests serialization/deserialization compatibility.
*/
+ @TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "Verifies serialization.",
+ targets = {
+ @TestTarget(
+ methodName = "!SerializationSelf",
+ methodArgs = {}
+ )
+ })
public void testSerializationSelf() throws Exception {
SerializationTest.verifySelf(new IllegalCharsetNameException(
@@ -86,6 +114,15 @@ public class IllegalCharsetNameExceptionTest extends TestCase {
/**
* @tests serialization/deserialization compatibility with RI.
*/
+ @TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "Verifies serialization.",
+ targets = {
+ @TestTarget(
+ methodName = "!SerializationGolden",
+ methodArgs = {}
+ )
+ })
public void testSerializationCompatibility() throws Exception {
SerializationTest.verifyGolden(this, new IllegalCharsetNameException(
diff --git a/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/MalformedInputExceptionTest.java b/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/MalformedInputExceptionTest.java
index 40ab9c7..4ec998f 100644
--- a/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/MalformedInputExceptionTest.java
+++ b/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/MalformedInputExceptionTest.java
@@ -16,6 +16,11 @@
package org.apache.harmony.nio_char.tests.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
import java.io.Serializable;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.MalformedInputException;
@@ -25,11 +30,27 @@ import junit.framework.TestCase;
import org.apache.harmony.testframework.serialization.SerializationTest;
import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
+@TestTargetClass(MalformedInputException.class)
/**
* Test class MalformedInputException.
*/
public class MalformedInputExceptionTest extends TestCase {
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "MalformedInputException",
+ methodArgs = {int.class}
+ ),@TestTarget(
+ methodName = "getMessage",
+ methodArgs = {}
+ ),@TestTarget(
+ methodName = "getInputLength",
+ methodArgs = {}
+ )
+ })
public void testConstructor() {
MalformedInputException ex = new MalformedInputException(3);
assertTrue(ex instanceof CharacterCodingException);
@@ -68,6 +89,15 @@ public class MalformedInputExceptionTest extends TestCase {
/**
* @tests serialization/deserialization compatibility.
*/
+ @TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "Verifies serialization.",
+ targets = {
+ @TestTarget(
+ methodName = "!SerializationSelf",
+ methodArgs = {}
+ )
+ })
public void testSerializationSelf() throws Exception {
SerializationTest.verifySelf(new MalformedInputException(11),
@@ -77,6 +107,15 @@ public class MalformedInputExceptionTest extends TestCase {
/**
* @tests serialization/deserialization compatibility with RI.
*/
+ @TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "Verifies serialization.",
+ targets = {
+ @TestTarget(
+ methodName = "!SerializationGolden",
+ methodArgs = {}
+ )
+ })
public void testSerializationCompatibility() throws Exception {
SerializationTest.verifyGolden(this, new MalformedInputException(11),
diff --git a/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/UnmappableCharacterExceptionTest.java b/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/UnmappableCharacterExceptionTest.java
index 0abefbe..cbd256a 100644
--- a/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/UnmappableCharacterExceptionTest.java
+++ b/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/UnmappableCharacterExceptionTest.java
@@ -16,6 +16,11 @@
package org.apache.harmony.nio_char.tests.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
import java.io.Serializable;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.UnmappableCharacterException;
@@ -25,11 +30,27 @@ import junit.framework.TestCase;
import org.apache.harmony.testframework.serialization.SerializationTest;
import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
+@TestTargetClass(UnmappableCharacterException.class)
/**
* Test class UnmappableCharacterException.
*/
public class UnmappableCharacterExceptionTest extends TestCase {
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "UnmappableCharacterException",
+ methodArgs = {int.class}
+ ), @TestTarget(
+ methodName = "getMessage",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "getInputLength",
+ methodArgs = {}
+ )
+ })
public void testConstructor() {
UnmappableCharacterException ex = new UnmappableCharacterException(3);
assertTrue(ex instanceof CharacterCodingException);
@@ -69,6 +90,15 @@ public class UnmappableCharacterExceptionTest extends TestCase {
/**
* @tests serialization/deserialization compatibility.
*/
+ @TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "Verifies serialization.",
+ targets = {
+ @TestTarget(
+ methodName = "!SerializationSelf",
+ methodArgs = {}
+ )
+ })
public void testSerializationSelf() throws Exception {
SerializationTest.verifySelf(new UnmappableCharacterException(11),
@@ -78,6 +108,15 @@ public class UnmappableCharacterExceptionTest extends TestCase {
/**
* @tests serialization/deserialization compatibility with RI.
*/
+ @TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "Verifies serialization.",
+ targets = {
+ @TestTarget(
+ methodName = "!SerializationGolden",
+ methodArgs = {}
+ )
+ })
public void testSerializationCompatibility() throws Exception {
SerializationTest.verifyGolden(this, new UnmappableCharacterException(
diff --git a/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/UnsupportedCharsetExceptionTest.java b/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/UnsupportedCharsetExceptionTest.java
index dd17848..ca736e2 100644
--- a/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/UnsupportedCharsetExceptionTest.java
+++ b/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/UnsupportedCharsetExceptionTest.java
@@ -16,6 +16,11 @@
package org.apache.harmony.nio_char.tests.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
import java.io.Serializable;
import java.nio.charset.UnsupportedCharsetException;
@@ -24,11 +29,25 @@ import junit.framework.TestCase;
import org.apache.harmony.testframework.serialization.SerializationTest;
import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
+@TestTargetClass(UnsupportedCharsetException.class)
/**
* Test class UnsupportedCharsetException.
*/
public class UnsupportedCharsetExceptionTest extends TestCase {
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "UnsupportedCharsetException",
+ methodArgs = {java.lang.String.class}
+ ),@TestTarget(
+ methodName = "getCharsetName",
+ methodArgs = {}
+ )
+
+ })
public void testConstructor() {
UnsupportedCharsetException ex = new UnsupportedCharsetException(
"impossible");
@@ -76,6 +95,15 @@ public class UnsupportedCharsetExceptionTest extends TestCase {
/**
* @tests serialization/deserialization compatibility.
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "Verifies serialization.",
+ targets = {
+ @TestTarget(
+ methodName = "!SerializationSelf",
+ methodArgs = {}
+ )
+ })
public void testSerializationSelf() throws Exception {
SerializationTest.verifySelf(new UnsupportedCharsetException(
@@ -85,6 +113,15 @@ public class UnsupportedCharsetExceptionTest extends TestCase {
/**
* @tests serialization/deserialization compatibility with RI.
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "Verifies serialization.",
+ targets = {
+ @TestTarget(
+ methodName = "!SerializationGolden",
+ methodArgs = {}
+ )
+ })
public void testSerializationCompatibility() throws Exception {
SerializationTest.verifyGolden(this, new UnsupportedCharsetException(
diff --git a/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/spi/CharsetProviderTest.java b/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/spi/CharsetProviderTest.java
index 7a90b56..4321479 100644
--- a/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/spi/CharsetProviderTest.java
+++ b/nio_char/src/test/java/org/apache/harmony/nio_char/tests/java/nio/charset/spi/CharsetProviderTest.java
@@ -16,13 +16,18 @@
package org.apache.harmony.nio_char.tests.java.nio.charset.spi;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
import java.nio.charset.Charset;
import java.nio.charset.spi.CharsetProvider;
import java.security.Permission;
import java.util.Iterator;
import junit.framework.TestCase;
-
+@TestTargetClass(CharsetProvider.class)
/**
* Test class java.nio.charset.spi.CharsetProvider.
*/
@@ -31,6 +36,15 @@ public class CharsetProviderTest extends TestCase {
/*
* Test the security check in the constructor.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Normal condition does not checked.",
+ targets = {
+ @TestTarget(
+ methodName = "CharsetProvider",
+ methodArgs = {}
+ )
+ })
public void testConstructor() {
// with sufficient privilege
new MockCharsetProvider();
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/ASCCharsetDecoderTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/ASCCharsetDecoderTest.java
index 5dcf956..d41f5bf 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/ASCCharsetDecoderTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/ASCCharsetDecoderTest.java
@@ -16,10 +16,13 @@
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
+@TestTargetClass(java.nio.charset.CharsetDecoder.class)
public class ASCCharsetDecoderTest extends CharsetDecoderTest {
protected void setUp() throws Exception {
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/ASCCharsetTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/ASCCharsetTest.java
index d907e93..7d0e366 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/ASCCharsetTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/ASCCharsetTest.java
@@ -16,6 +16,12 @@
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
+@TestTargetClass(java.nio.charset.Charset.class)
/**
* Test charset US-ASCII.
*/
@@ -37,6 +43,15 @@ public class ASCCharsetTest extends AbstractCharsetTestCase {
*
* @see tests.api.java.nio.charset.ConcreteCharsetTest#testEncode_Normal()
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.lang.String.class}
+ )
+ })
public void testEncode_Normal() {
String input = "ab\u5D14\u654F";
byte[] output = new byte[] { 97, 98,
@@ -50,6 +65,15 @@ public class ASCCharsetTest extends AbstractCharsetTestCase {
*
* @see tests.api.java.nio.charset.ConcreteCharsetTest#testDecode_Normal()
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class}
+ )
+ })
public void testDecode_Normal() {
byte[] input = new byte[] { 97, 98, 63, 63 };
char[] output = "ab??".toCharArray();
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/AbstractCharsetTestCase.java b/nio_char/src/test/java/tests/api/java/nio/charset/AbstractCharsetTestCase.java
index 9a9b45c..6ded102 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/AbstractCharsetTestCase.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/AbstractCharsetTestCase.java
@@ -1,11 +1,16 @@
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import junit.framework.TestCase;
-
+@TestTargetClass(java.nio.charset.Charset.class)
/**
* Super class for concrete charset test suites.
*/
@@ -59,6 +64,15 @@ public abstract class AbstractCharsetTestCase extends TestCase {
/*
* Test canEncode.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {}
+ )
+ })
public void testCanEncode() {
assertEquals(this.canEncode, this.testingCharset.canEncode());
}
@@ -66,6 +80,15 @@ public abstract class AbstractCharsetTestCase extends TestCase {
/*
* Test isRegistered.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "isRegistered",
+ methodArgs = {}
+ )
+ })
public void testIsRegistered() {
assertEquals(this.isRegistered, this.testingCharset.isRegistered());
}
@@ -73,6 +96,15 @@ public abstract class AbstractCharsetTestCase extends TestCase {
/*
* Test name.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "name",
+ methodArgs = {}
+ )
+ })
public void testName() {
assertEquals(this.canonicalName, this.testingCharset.name());
// assertEquals(this.canonicalName, this.testingCharset.displayName());
@@ -83,6 +115,15 @@ public abstract class AbstractCharsetTestCase extends TestCase {
/*
* Test aliases.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Test functionality completely missed.",
+ targets = {
+ @TestTarget(
+ methodName = "aliases",
+ methodArgs = {}
+ )
+ })
public void testAliases() {
for (int i = 0; i < this.aliases.length; i++) {
Charset c = Charset.forName(this.aliases[i]);
@@ -95,6 +136,15 @@ public abstract class AbstractCharsetTestCase extends TestCase {
/*
* Test the method encode(String) with null.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.lang.String.class}
+ )
+ })
public void testEncode_String_Null() {
try {
this.testingCharset.encode((String) null);
@@ -107,6 +157,15 @@ public abstract class AbstractCharsetTestCase extends TestCase {
/*
* Test the method encode(CharBuffer) with null.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class}
+ )
+ })
public void testEncode_CharBuffer_Null() {
try {
this.testingCharset.encode((CharBuffer) null);
@@ -134,6 +193,15 @@ public abstract class AbstractCharsetTestCase extends TestCase {
/*
* Test encoding.
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "Super class for testing.",
+ targets = {
+ @TestTarget(
+ methodName = "",
+ methodArgs = {}
+ )
+ })
public abstract void testEncode_Normal();
/*
@@ -154,5 +222,14 @@ public abstract class AbstractCharsetTestCase extends TestCase {
/*
* Test decoding.
*/
+ @TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "Super class for testing.",
+ targets = {
+ @TestTarget(
+ methodName = "",
+ methodArgs = {}
+ )
+ })
public abstract void testDecode_Normal();
}
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/AllTests.java b/nio_char/src/test/java/tests/api/java/nio/charset/AllTests.java
index e718651..666d698 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/AllTests.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/AllTests.java
@@ -1,12 +1,12 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
- *
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * 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.
@@ -16,46 +16,50 @@
package tests.api.java.nio.charset;
-import org.apache.harmony.nio_char.tests.java.nio.charset.ASCIICharsetEncoderTest;
-
import junit.framework.Test;
import junit.framework.TestSuite;
/**
- * Test suite for java.nio.charset package.
+ * This is autogenerated source file. Includes tests for package tests.api.java.nio.charset;
*/
+
public class AllTests {
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(AllTests.suite());
+ }
+
public static Test suite() {
- TestSuite suite = new TestSuite("Test for tests.api.java.nio.charset");
+ TestSuite suite = new TestSuite("All tests for package tests.api.java.nio.charset;");
// $JUnit-BEGIN$
- suite.addTestSuite(CodingErrorActionTest.class);
- suite.addTestSuite(CoderResultTest.class);
- suite.addTestSuite(CharsetTest.class);
+
+ suite.addTestSuite(ASCCharsetDecoderTest.class);
suite.addTestSuite(ASCCharsetTest.class);
- suite.addTestSuite(ISOCharsetTest.class);
- suite.addTestSuite(UTF8CharsetTest.class);
- suite.addTestSuite(UTF16CharsetTest.class);
- suite.addTestSuite(UTF16BECharsetTest.class);
- suite.addTestSuite(UTF16LECharsetTest.class);
+ suite.addTestSuite(CharsetDecoderTest.class);
suite.addTestSuite(CharsetEncoderTest.class);
+ suite.addTestSuite(CharsetProviderTest.class);
+ suite.addTestSuite(CharsetTest.class);
+ suite.addTestSuite(CoderResultTest.class);
+ suite.addTestSuite(CodingErrorActionTest.class);
+// GBCharset not supported
+// suite.addTestSuite(GBCharsetDecoderTest.class);
+// suite.addTestSuite(GBCharsetEncoderTest.class);
+ suite.addTestSuite(ISOCharsetDecoderTest.class);
suite.addTestSuite(ISOCharsetEncoderTest.class);
- suite.addTestSuite(UTFCharsetEncoderTest.class);
- // GBCharset not supported
- // suite.addTestSuite(GBCharsetEncoderTest.class);
- suite.addTestSuite(ASCIICharsetEncoderTest.class);
- suite.addTestSuite(UTF16CharsetEncoderTest.class);
- suite.addTestSuite(UTF16LECharsetEncoderTest.class);
+ suite.addTestSuite(ISOCharsetTest.class);
+ suite.addTestSuite(UTF16BECharsetDecoderTest.class);
suite.addTestSuite(UTF16BECharsetEncoderTest.class);
- suite.addTestSuite(CharsetDecoderTest.class);
- suite.addTestSuite(ISOCharsetDecoderTest.class);
- suite.addTestSuite(UTFCharsetDecoderTest.class);
- // GBCharset not supported
- // suite.addTestSuite(GBCharsetDecoderTest.class);
- suite.addTestSuite(ASCCharsetDecoderTest.class);
+ suite.addTestSuite(UTF16BECharsetTest.class);
suite.addTestSuite(UTF16CharsetDecoderTest.class);
+ suite.addTestSuite(UTF16CharsetEncoderTest.class);
+ suite.addTestSuite(UTF16CharsetTest.class);
suite.addTestSuite(UTF16LECharsetDecoderTest.class);
- suite.addTestSuite(UTF16BECharsetDecoderTest.class);
+ suite.addTestSuite(UTF16LECharsetEncoderTest.class);
+ suite.addTestSuite(UTF16LECharsetTest.class);
+ suite.addTestSuite(UTF8CharsetTest.class);
+ suite.addTestSuite(UTFCharsetDecoderTest.class);
+ suite.addTestSuite(UTFCharsetEncoderTest.class);
+
// $JUnit-END$
return suite;
}
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/CharsetDecoderTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/CharsetDecoderTest.java
index 0d067b0..74bb852 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/CharsetDecoderTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/CharsetDecoderTest.java
@@ -15,6 +15,11 @@
*/
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
@@ -27,7 +32,7 @@ import java.nio.charset.MalformedInputException;
import java.nio.charset.UnmappableCharacterException;
import junit.framework.TestCase;
-
+@TestTargetClass(CharsetDecoder.class)
/**
* API unit test for java.nio.CharsetDecoder
*/
@@ -70,6 +75,33 @@ public class CharsetDecoderTest extends TestCase {
// assertTrue(decoder.maxCharsPerByte() == MAX_BYTES);
// }
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "charset",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "detectedCharset",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "isCharsetDetected",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "isAutoDetecting",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "malformedInputAction",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "unmappableCharacterAction",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "replacement",
+ methodArgs = {}
+ )
+ })
public void testDefaultValues() {
assertSame(cs, decoder.charset());
try {
@@ -92,6 +124,24 @@ public class CharsetDecoderTest extends TestCase {
/*
* test constructor
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "CharsetDecoder",
+ methodArgs = {java.nio.charset.Charset.class, float.class, float.class}
+ ), @TestTarget(
+ methodName = "charset",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "averageCharsPerByte",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "maxCharsPerByte",
+ methodArgs = {}
+ )
+ })
public void testCharsetDecoder() {
// default value
decoder = new MockCharsetDecoder(cs, (float) AVER_BYTES, MAX_BYTES);
@@ -148,6 +198,18 @@ public class CharsetDecoderTest extends TestCase {
/*
* test onMalformedInput
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "malformedInputAction",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "onMalformedInput",
+ methodArgs = {java.nio.charset.CodingErrorAction.class}
+ )
+ })
public void testOnMalformedInput() {
assertSame(CodingErrorAction.REPORT, decoder.malformedInputAction());
try {
@@ -162,6 +224,18 @@ public class CharsetDecoderTest extends TestCase {
/*
* test unmappableCharacter
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "unmappableCharacterAction",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "onUnmappableCharacter",
+ methodArgs = {java.nio.charset.CodingErrorAction.class}
+ )
+ })
public void testOnUnmappableCharacter() {
assertSame(CodingErrorAction.REPORT, decoder
.unmappableCharacterAction());
@@ -178,6 +252,18 @@ public class CharsetDecoderTest extends TestCase {
/*
* test replaceWith
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "replaceWith",
+ methodArgs = {java.lang.String.class}
+ ), @TestTarget(
+ methodName = "replacement",
+ methodArgs = {}
+ )
+ })
public void testReplaceWith() {
try {
decoder.replaceWith(null);
@@ -202,6 +288,15 @@ public class CharsetDecoderTest extends TestCase {
/*
* Class under test for CharBuffer decode(ByteBuffer)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "IllegalStateException & CharacterCodingException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class}
+ )
+ })
public void testDecodeByteBuffer() throws CharacterCodingException {
implTestDecodeByteBuffer();
}
@@ -227,6 +322,15 @@ public class CharsetDecoderTest extends TestCase {
assertEquals(new String(out.array(), 0, out.limit()), unistr);
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "IllegalStateException & CharacterCodingException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class}
+ )
+ })
public void testDecodeByteBufferException()
throws CharacterCodingException, UnsupportedEncodingException {
CharBuffer out;
@@ -293,6 +397,16 @@ public class CharsetDecoderTest extends TestCase {
/*
* Class under test for CoderResult decode(ByteBuffer, CharBuffer, boolean)
*/
+
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Functional test. Exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class, java.nio.CharBuffer.class, boolean.class}
+ )
+ })
public void testDecodeByteBufferCharBufferboolean() {
implTestDecodeByteBufferCharBufferboolean();
}
@@ -369,11 +483,29 @@ public class CharsetDecoderTest extends TestCase {
assertCharBufferValue(out, bom + unistr);
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Functional test. Exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class, java.nio.CharBuffer.class, boolean.class}
+ )
+ })
public void testDecodeCharBufferByteBufferbooleanExceptionTrue()
throws CharacterCodingException, UnsupportedEncodingException {
implTestDecodeCharBufferByteBufferbooleanException(true);
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Functional test. Exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class, java.nio.CharBuffer.class, boolean.class}
+ )
+ })
public void testDecodeCharBufferByteBufferbooleanExceptionFalse()
throws CharacterCodingException, UnsupportedEncodingException {
implTestDecodeCharBufferByteBufferbooleanException(false);
@@ -482,6 +614,15 @@ public class CharsetDecoderTest extends TestCase {
/*
* test flush
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "flush",
+ methodArgs = {java.nio.CharBuffer.class}
+ )
+ })
public void testFlush() throws CharacterCodingException {
CharBuffer out = CharBuffer.allocate(10);
ByteBuffer in = ByteBuffer.wrap(new byte[] { 12, 12 });
@@ -501,6 +642,15 @@ public class CharsetDecoderTest extends TestCase {
*/
// Normal case: just after reset, and it also means reset can be done
// anywhere
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "reset",
+ methodArgs = {}
+ )
+ })
public void testResetIllegalState() throws CharacterCodingException {
byte[] gb = getUnibytes();
decoder.reset();
@@ -512,6 +662,18 @@ public class CharsetDecoderTest extends TestCase {
decoder.reset();
}
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "flush",
+ methodArgs = {java.nio.CharBuffer.class}
+ ), @TestTarget(
+ methodName = "reset",
+ methodArgs = {}
+ )
+ })
public void testFlushIllegalState() throws CharacterCodingException {
ByteBuffer in = ByteBuffer.wrap(new byte[] { 98, 98 });
CharBuffer out = CharBuffer.allocate(5);
@@ -544,6 +706,18 @@ public class CharsetDecoderTest extends TestCase {
}
// test illegal states for decode facade
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Exceptions checking missed",
+ targets = {
+ @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class}
+ ), @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class, java.nio.CharBuffer.class, boolean.class}
+ )
+ })
public void testDecodeFacadeIllegalState() throws CharacterCodingException {
// decode facade can be execute in anywhere
byte[] gb = getUnibytes();
@@ -577,6 +751,15 @@ public class CharsetDecoderTest extends TestCase {
}
// test illegal states for two decode method with endOfInput is true
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "CoderMalfunctionError checking missed",
+ targets = {
+ @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class, java.nio.CharBuffer.class, boolean.class}
+ )
+ })
public void testDecodeTrueIllegalState() throws CharacterCodingException {
ByteBuffer in = ByteBuffer.wrap(new byte[] { 98, 98 });
CharBuffer out = CharBuffer.allocate(100);
@@ -617,6 +800,15 @@ public class CharsetDecoderTest extends TestCase {
}
// test illegal states for two decode method with endOfInput is false
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "CoderMalfunctionError checking missed",
+ targets = {
+ @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class, java.nio.CharBuffer.class, boolean.class}
+ )
+ })
public void testDecodeFalseIllegalState() throws CharacterCodingException {
ByteBuffer in = ByteBuffer.wrap(new byte[] { 98, 98 });
CharBuffer out = CharBuffer.allocate(5);
@@ -674,12 +866,30 @@ public class CharsetDecoderTest extends TestCase {
* ---------------------------------
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "implFlush",
+ methodArgs = {java.nio.CharBuffer.class}
+ )
+ })
public void testImplFlush() {
decoder = new MockCharsetDecoder(cs, 1, 3);
assertEquals(CoderResult.UNDERFLOW, ((MockCharsetDecoder) decoder)
.pubImplFlush(null));
}
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "implOnMalformedInput",
+ methodArgs = {java.nio.charset.CodingErrorAction.class}
+ )
+ })
public void testImplOnMalformedInput() {
decoder = new MockCharsetDecoder(cs, 1, 3);
assertEquals(CoderResult.UNDERFLOW, ((MockCharsetDecoder) decoder)
@@ -687,16 +897,43 @@ public class CharsetDecoderTest extends TestCase {
}
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "implOnUnmappableCharacter",
+ methodArgs = {java.nio.charset.CodingErrorAction.class}
+ )
+ })
public void testImplOnUnmappableCharacter() {
decoder = new MockCharsetDecoder(cs, 1, 3);
((MockCharsetDecoder) decoder).pubImplOnUnmappableCharacter(null);
}
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "implReplaceWith",
+ methodArgs = {java.lang.String.class}
+ )
+ })
public void testImplReplaceWith() {
decoder = new MockCharsetDecoder(cs, 1, 3);
((MockCharsetDecoder) decoder).pubImplReplaceWith(null);
}
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "implReset",
+ methodArgs = {}
+ )
+ })
public void testImplReset() {
decoder = new MockCharsetDecoder(cs, 1, 3);
((MockCharsetDecoder) decoder).pubImplReset();
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/CharsetEncoderTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/CharsetEncoderTest.java
index 3284a57..475cd87 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/CharsetEncoderTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/CharsetEncoderTest.java
@@ -15,6 +15,11 @@
*/
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.CharacterCodingException;
@@ -29,7 +34,7 @@ import java.nio.charset.UnsupportedCharsetException;
import java.util.Arrays;
import junit.framework.TestCase;
-
+@TestTargetClass(CharsetEncoder.class)
/**
* API unit test for java.nio.charset.CharsetEncoder
*/
@@ -81,11 +86,44 @@ public class CharsetEncoderTest extends TestCase {
super.tearDown();
}
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "averageBytesPerChar",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "maxBytesPerChar",
+ methodArgs = {}
+ )
+ })
public void testSpecificDefaultValue() {
assertTrue(encoder.averageBytesPerChar() == AVER_BYTES);
assertTrue(encoder.maxBytesPerChar() == MAX_BYTES);
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "onMalformedInput & onUnmappableCharacter requires check for IllegalArgumentException",
+ targets = {
+ @TestTarget(
+ methodName = "malformedInputAction",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "unmappableCharacterAction",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "onMalformedInput",
+ methodArgs = {java.nio.charset.CodingErrorAction.class}
+ ), @TestTarget(
+ methodName = "onUnmappableCharacter",
+ methodArgs = {java.nio.charset.CodingErrorAction.class}
+ ), @TestTarget(
+ methodName = "replacement",
+ methodArgs = {}
+ )
+ })
public void testDefaultValue() {
assertEquals(CodingErrorAction.REPORT, encoder.malformedInputAction());
assertEquals(CodingErrorAction.REPORT, encoder
@@ -105,6 +143,33 @@ public class CharsetEncoderTest extends TestCase {
/*
* Class under test for constructor CharsetEncoder(Charset, float, float)
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "charset",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "averageBytesPerChar",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "maxBytesPerChar",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "malformedInputAction",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "unmappableCharacterAction",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "CharsetEncoder",
+ methodArgs = {java.nio.charset.Charset.class, float.class, float.class}
+ ), @TestTarget(
+ methodName = "replacement",
+ methodArgs = {}
+ )
+ })
public void testCharsetEncoderCharsetfloatfloat() {
// default value
encoder = new MockCharsetEncoder(cs, (float) AVER_BYTES, MAX_BYTES);
@@ -174,6 +239,27 @@ public class CharsetEncoderTest extends TestCase {
* Class under test for constructor CharsetEncoder(Charset, float, float,
* byte[])
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "CharsetEncoder",
+ methodArgs = {java.nio.charset.Charset.class, float.class, float.class, byte[].class}
+ ), @TestTarget(
+ methodName = "charset",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "averageBytesPerChar",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "maxBytesPerChar",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "replacement",
+ methodArgs = {}
+ )
+ })
public void testCharsetEncoderCharsetfloatfloatbyteArray() {
byte[] ba = getLegalByteArray();
// normal case
@@ -248,6 +334,15 @@ public class CharsetEncoderTest extends TestCase {
/*
* Class under test for boolean canEncode(char)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {char.class}
+ )
+ })
public void testCanEncodechar() throws CharacterCodingException {
// for non-mapped char
assertTrue(encoder.canEncode('\uc2c0'));
@@ -267,6 +362,27 @@ public class CharsetEncoderTest extends TestCase {
// Normal case: just after reset, and it also means reset can be done
// anywhere
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {char.class}
+ ), @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {java.lang.CharSequence.class}
+ ), @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class}
+ ), @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class, java.nio.ByteBuffer.class, boolean.class}
+ ), @TestTarget(
+ methodName = "reset",
+ methodArgs = {}
+ )
+ })
public void testResetIllegalState() throws CharacterCodingException {
assertSame(encoder, encoder.reset());
encoder.canEncode('\ud901');
@@ -281,6 +397,18 @@ public class CharsetEncoderTest extends TestCase {
assertSame(encoder, encoder.reset());
}
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "reset",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "flush",
+ methodArgs = {java.nio.ByteBuffer.class}
+ )
+ })
public void testFlushIllegalState() throws CharacterCodingException {
CharBuffer in = CharBuffer.wrap("aaa");
ByteBuffer out = ByteBuffer.allocate(5);
@@ -309,6 +437,27 @@ public class CharsetEncoderTest extends TestCase {
}
// test illegal states for encode facade
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class}
+ ), @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {char.class}
+ ), @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {java.lang.CharSequence.class}
+ ), @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class, java.nio.ByteBuffer.class, boolean.class}
+ ), @TestTarget(
+ methodName = "flush",
+ methodArgs = {java.nio.ByteBuffer.class}
+ )
+ })
public void testEncodeFacadeIllegalState() throws CharacterCodingException {
// encode facade can be execute in anywhere
CharBuffer in = CharBuffer.wrap("aaa");
@@ -354,6 +503,27 @@ public class CharsetEncoderTest extends TestCase {
}
// test illegal states for two encode method with endOfInput is true
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class, java.nio.ByteBuffer.class, boolean.class}
+ ), @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {char.class}
+ ), @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {java.lang.CharSequence.class}
+ ), @TestTarget(
+ methodName = "reset",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "flush",
+ methodArgs = {java.nio.ByteBuffer.class}
+ )
+ })
public void testEncodeTrueIllegalState() throws CharacterCodingException {
CharBuffer in = CharBuffer.wrap("aaa");
ByteBuffer out = ByteBuffer.allocate(5);
@@ -404,6 +574,30 @@ public class CharsetEncoderTest extends TestCase {
}
// test illegal states for two encode method with endOfInput is false
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class, java.nio.ByteBuffer.class, boolean.class}
+ ), @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class}
+ ), @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {char.class}
+ ), @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {java.lang.CharSequence.class}
+ ), @TestTarget(
+ methodName = "reset",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "flush",
+ methodArgs = {java.nio.ByteBuffer.class}
+ )
+ })
public void testEncodeFalseIllegalState() throws CharacterCodingException {
CharBuffer in = CharBuffer.wrap("aaa");
ByteBuffer out = ByteBuffer.allocate(5);
@@ -462,6 +656,24 @@ public class CharsetEncoderTest extends TestCase {
}
// test illegal states for two canEncode methods
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {char.class}
+ ), @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {java.lang.CharSequence.class}
+ ), @TestTarget(
+ methodName = "reset",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "flush",
+ methodArgs = {java.nio.ByteBuffer.class}
+ )
+ })
public void testCanEncodeIllegalState() throws CharacterCodingException {
// Normal case: just created
encoder.canEncode("\ud900\udc00");
@@ -508,6 +720,15 @@ public class CharsetEncoderTest extends TestCase {
/*
* Class under test for boolean canEncode(CharSequence)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {java.lang.CharSequence.class}
+ )
+ })
public void testCanEncodeCharSequence() {
// for non-mapped char
assertTrue(encoder.canEncode("\uc2c0"));
@@ -524,6 +745,15 @@ public class CharsetEncoderTest extends TestCase {
/*
* Class under test for Charset charset()
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "CharsetEncoder",
+ methodArgs = {java.nio.charset.Charset.class, float.class, float.class}
+ )
+ })
public void testCharset() {
try {
encoder = new MockCharsetEncoder(Charset.forName("gbk"), 1,
@@ -538,6 +768,15 @@ public class CharsetEncoderTest extends TestCase {
/*
* Class under test for ByteBuffer encode(CharBuffer)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Functional test. Exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class}
+ )
+ })
public void testEncodeCharBuffer() throws CharacterCodingException {
// Null pointer
try {
@@ -598,6 +837,15 @@ public class CharsetEncoderTest extends TestCase {
return CharBuffer.wrap("runtime buffer");
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Missed checking for IllegalStateException & CharacterCodingException",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class}
+ )
+ })
public void testEncodeCharBufferException() throws CharacterCodingException {
ByteBuffer out;
CharBuffer in;
@@ -677,6 +925,15 @@ public class CharsetEncoderTest extends TestCase {
/*
* Class under test for CoderResult encode(CharBuffer, ByteBuffer, boolean)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Functional test. Exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class, java.nio.ByteBuffer.class, boolean.class}
+ )
+ })
public void testEncodeCharBufferByteBufferboolean()
throws CharacterCodingException {
ByteBuffer out = ByteBuffer.allocate(200);
@@ -782,11 +1039,29 @@ public class CharsetEncoderTest extends TestCase {
}
}
+ @TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Functional test. Exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class, java.nio.ByteBuffer.class, boolean.class}
+ )
+ })
public void testEncodeCharBufferByteBufferbooleanExceptionFalse()
throws CharacterCodingException {
implTestEncodeCharBufferByteBufferbooleanException(false);
}
+ @TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Functional test. Exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class, java.nio.ByteBuffer.class, boolean.class}
+ )
+ })
public void testEncodeCharBufferByteBufferbooleanExceptionTrue()
throws CharacterCodingException {
implTestEncodeCharBufferByteBufferbooleanException(true);
@@ -887,6 +1162,15 @@ public class CharsetEncoderTest extends TestCase {
/*
* Class under test for CoderResult flush(ByteBuffer)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class, java.nio.ByteBuffer.class, boolean.class}
+ )
+ })
public void testFlush() throws CharacterCodingException {
ByteBuffer out = ByteBuffer.allocate(6);
CharBuffer in = CharBuffer.wrap("aaa");
@@ -902,6 +1186,15 @@ public class CharsetEncoderTest extends TestCase {
/*
* test isLegalReplacement(byte[])
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "isLegalReplacement",
+ methodArgs = {byte[].class}
+ )
+ })
public void testIsLegalReplacement() {
try {
encoder.isLegalReplacement(null);
@@ -917,6 +1210,15 @@ public class CharsetEncoderTest extends TestCase {
}
}
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "isLegalReplacement",
+ methodArgs = {byte[].class}
+ )
+ })
public void testIsLegalReplacementEmptyArray() {
// ISO, ASC, GB, UTF8 encoder will throw exception in RI
// others will pass
@@ -927,6 +1229,18 @@ public class CharsetEncoderTest extends TestCase {
// }
}
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "onMalformedInput",
+ methodArgs = {java.nio.charset.CodingErrorAction.class}
+ ), @TestTarget(
+ methodName = "malformedInputAction",
+ methodArgs = {}
+ )
+ })
public void testOnMalformedInput() {
assertSame(CodingErrorAction.REPORT, encoder.malformedInputAction());
try {
@@ -938,6 +1252,18 @@ public class CharsetEncoderTest extends TestCase {
assertSame(CodingErrorAction.IGNORE, encoder.malformedInputAction());
}
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "onUnmappableCharacter",
+ methodArgs = {java.nio.charset.CodingErrorAction.class}
+ ), @TestTarget(
+ methodName = "unmappableCharacterAction",
+ methodArgs = {}
+ )
+ })
public void testOnUnmappableCharacter() {
assertSame(CodingErrorAction.REPORT, encoder
.unmappableCharacterAction());
@@ -951,6 +1277,18 @@ public class CharsetEncoderTest extends TestCase {
.unmappableCharacterAction());
}
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "replaceWith",
+ methodArgs = {byte[].class}
+ ), @TestTarget(
+ methodName = "replacement",
+ methodArgs = {}
+ )
+ })
public void testReplacement() {
try {
encoder.replaceWith(null);
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/CharsetProviderTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/CharsetProviderTest.java
index 74b56a9..e6b69bc 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/CharsetProviderTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/CharsetProviderTest.java
@@ -15,6 +15,11 @@
*/
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
@@ -28,6 +33,7 @@ import junit.framework.TestCase;
import tests.api.java.nio.charset.CharsetTest.MockCharset;
import tests.api.java.nio.charset.CharsetTest.MockSecurityManager;
+@TestTargetClass(CharsetProvider.class)
/**
* Test charset providers managed by Charset.
*/
@@ -91,7 +97,7 @@ public class CharsetProviderTest extends TestCase {
* Test the method isSupported(String) with charset supported by some
* providers (multiple).
*/
- public void testIsSupported_And_ForName_NormalProvider() throws Exception {
+ public void _testIsSupported_And_ForName_NormalProvider() throws Exception {
try {
assertFalse(Charset.isSupported("mockCharset10"));
assertFalse(Charset.isSupported("mockCharset11"));
@@ -159,6 +165,15 @@ public class CharsetProviderTest extends TestCase {
* Test the method isSupported(String) when the configuration file contains
* a non-existing class name.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Test for Charset.isSupported",
+ targets = {
+ @TestTarget(
+ methodName = "charsets",
+ methodArgs = {}
+ )
+ })
public void testIsSupported_NonExistingClass() throws Exception {
try {
StringBuffer sb = new StringBuffer();
@@ -178,7 +193,7 @@ public class CharsetProviderTest extends TestCase {
* Test the method isSupported(String) when the configuration file contains
* a non-CharsetProvider class name.
*/
- public void testIsSupported_NotCharsetProviderClass() throws Exception {
+ public void _testIsSupported_NotCharsetProviderClass() throws Exception {
try {
StringBuffer sb = new StringBuffer();
sb.append("java.lang.String\r");
@@ -197,7 +212,7 @@ public class CharsetProviderTest extends TestCase {
* Test the method isSupported(String) with insufficient privilege to use
* charset provider.
*/
- public void testIsSupported_InsufficientPrivilege() throws Exception {
+ public void _testIsSupported_InsufficientPrivilege() throws Exception {
SecurityManager oldMan = System.getSecurityManager();
System.setSecurityManager(new MockSecurityManager());
try {
@@ -225,6 +240,15 @@ public class CharsetProviderTest extends TestCase {
* Test the method forName(String) when the charset provider supports a
* built-in charset.
*/
+ @TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Test for Charset.isSupported",
+ targets = {
+ @TestTarget(
+ methodName = "charsets",
+ methodArgs = {}
+ )
+ })
public void testForName_DuplicateWithBuiltInCharset() throws Exception {
try {
StringBuffer sb = new StringBuffer();
@@ -243,7 +267,7 @@ public class CharsetProviderTest extends TestCase {
* Test the method forName(String) when the configuration file contains a
* non-existing class name.
*/
- public void testForName_NonExistingClass() throws Exception {
+ public void _testForName_NonExistingClass() throws Exception {
try {
StringBuffer sb = new StringBuffer();
sb.append("impossible\r");
@@ -262,7 +286,7 @@ public class CharsetProviderTest extends TestCase {
* Test the method forName(String) when the configuration file contains a
* non-CharsetProvider class name.
*/
- public void testForName_NotCharsetProviderClass() throws Exception {
+ public void _testForName_NotCharsetProviderClass() throws Exception {
try {
StringBuffer sb = new StringBuffer();
sb.append("java.lang.String\r");
@@ -281,7 +305,7 @@ public class CharsetProviderTest extends TestCase {
* Test the method availableCharsets() with charset supported by some
* providers (multiple).
*/
- public void testAvailableCharsets_NormalProvider() throws Exception {
+ public void _testAvailableCharsets_NormalProvider() throws Exception {
try {
assertFalse(Charset.availableCharsets()
.containsKey("mockCharset10"));
@@ -340,6 +364,15 @@ public class CharsetProviderTest extends TestCase {
* Test the method availableCharsets(String) when the configuration file
* contains a non-existing class name.
*/
+ @TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Test for Charset.isSupported",
+ targets = {
+ @TestTarget(
+ methodName = "charsets",
+ methodArgs = {}
+ )
+ })
public void testAvailableCharsets_NonExistingClass() throws Exception {
try {
StringBuffer sb = new StringBuffer();
@@ -359,7 +392,7 @@ public class CharsetProviderTest extends TestCase {
* Test the method availableCharsets(String) when the configuration file
* contains a non-CharsetProvider class name.
*/
- public void testAvailableCharsets_NotCharsetProviderClass()
+ public void _testAvailableCharsets_NotCharsetProviderClass()
throws Exception {
try {
StringBuffer sb = new StringBuffer();
@@ -379,6 +412,15 @@ public class CharsetProviderTest extends TestCase {
* Test the method availableCharsets(String) when the configuration file
* contains an illegal string.
*/
+ @TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Test for Charset.isSupported",
+ targets = {
+ @TestTarget(
+ methodName = "charsets",
+ methodArgs = {}
+ )
+ })
public void testAvailableCharsets_IllegalString() throws Exception {
try {
StringBuffer sb = new StringBuffer();
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/CharsetTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/CharsetTest.java
index daf24a5..22d2f8b 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/CharsetTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/CharsetTest.java
@@ -16,6 +16,11 @@
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
@@ -33,6 +38,7 @@ import java.util.Vector;
import junit.framework.TestCase;
+@TestTargetClass(Charset.class)
/**
* Test class java.nio.Charset.
*/
@@ -61,6 +67,21 @@ public class CharsetTest extends TestCase {
/*
* Test the required 6 charsets are supported.
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "Test is OK for availableCharsets. For forName & isSupported only functionality tested.",
+ targets = {
+ @TestTarget(
+ methodName = "isSupported",
+ methodArgs = {java.lang.String.class}
+ ), @TestTarget(
+ methodName = "forName",
+ methodArgs = {java.lang.String.class}
+ ), @TestTarget(
+ methodName = "availableCharsets",
+ methodArgs = {}
+ )
+ })
public void testRequiredCharsetSupported() {
assertTrue(Charset.isSupported("US-ASCII"));
assertTrue(Charset.isSupported("ASCII"));
@@ -98,6 +119,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method isSupported(String) with null.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "IllegalArgumentException checked.",
+ targets = {
+ @TestTarget(
+ methodName = "isSupported",
+ methodArgs = {java.lang.String.class}
+ )
+ })
public void testIsSupported_Null() {
try {
Charset.isSupported(null);
@@ -111,6 +141,15 @@ public class CharsetTest extends TestCase {
* Test the method isSupported(String) with empty string.
*
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "check test on target vm and fix, now it is dummy",
+ targets = {
+ @TestTarget(
+ methodName = "isSupported",
+ methodArgs = {java.lang.String.class}
+ )
+ })
public void testIsSupported_EmptyString() {
try {
Charset.isSupported("");
@@ -124,6 +163,15 @@ public class CharsetTest extends TestCase {
* Test the method isSupported(String) with a string starting with ".".
*
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "isSupported",
+ methodArgs = {java.lang.String.class}
+ )
+ })
public void testIsSupported_InvalidInitialCharacter() {
try {
Charset.isSupported(".char");
@@ -135,6 +183,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method isSupported(String) with illegal charset name.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "IllegalArgumentException checked.",
+ targets = {
+ @TestTarget(
+ methodName = "isSupported",
+ methodArgs = {java.lang.String.class}
+ )
+ })
public void testIsSupported_IllegalName() {
try {
Charset.isSupported(" ///#$$");
@@ -147,6 +204,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method isSupported(String) with not supported charset name.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "isSupported",
+ methodArgs = {java.lang.String.class}
+ )
+ })
public void testIsSupported_NotSupported() {
assertFalse(Charset.isSupported("impossible"));
}
@@ -154,6 +220,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method forName(String) with null.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "forName",
+ methodArgs = {java.lang.String.class}
+ )
+ })
public void testForName_Null() {
try {
Charset.forName(null);
@@ -166,6 +241,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method forName(String) with empty string.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "forName",
+ methodArgs = {java.lang.String.class}
+ )
+ })
public void testForName_EmptyString() {
try {
Charset.forName("");
@@ -178,6 +262,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method forName(String) with a string starting with ".".
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "forName",
+ methodArgs = {java.lang.String.class}
+ )
+ })
public void testForName_InvalidInitialCharacter() {
try {
Charset.forName(".char");
@@ -190,6 +283,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method forName(String) with illegal charset name.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "forName",
+ methodArgs = {java.lang.String.class}
+ )
+ })
public void testForName_IllegalName() {
try {
Charset.forName(" ///#$$");
@@ -202,6 +304,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method forName(String) with not supported charset name.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "forName",
+ methodArgs = {java.lang.String.class}
+ )
+ })
public void testForName_NotSupported() {
try {
Charset.forName("impossible");
@@ -214,6 +325,24 @@ public class CharsetTest extends TestCase {
/*
* Test the constructor with normal parameter values.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "name",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "displayName",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "aliases",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "Charset",
+ methodArgs = {java.lang.String.class, java.lang.String[].class}
+ )
+ })
public void testConstructor_Normal() {
final String mockName = "mockChar1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.:-_";
MockCharset c = new MockCharset(mockName, new String[] { "mock" });
@@ -228,6 +357,15 @@ public class CharsetTest extends TestCase {
* Test the constructor with empty canonical name.
*
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "check test on target vm and fix, now it is dummy",
+ targets = {
+ @TestTarget(
+ methodName = "Charset",
+ methodArgs = {java.lang.String.class, java.lang.String[].class}
+ )
+ })
public void testConstructor_EmptyCanonicalName() {
try {
new MockCharset("", new String[0]);
@@ -242,6 +380,15 @@ public class CharsetTest extends TestCase {
* digit nor a letter.
*
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "Charset",
+ methodArgs = {java.lang.String.class, java.lang.String[].class}
+ )
+ })
public void testConstructor_IllegalCanonicalName_Initial() {
try {
new MockCharset("-123", new String[] { "mock" });
@@ -254,6 +401,15 @@ public class CharsetTest extends TestCase {
* Test the constructor with illegal canonical name, illegal character in
* the middle.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "Charset",
+ methodArgs = {java.lang.String.class, java.lang.String[].class}
+ )
+ })
public void testConstructor_IllegalCanonicalName_Middle() {
try {
new MockCharset("1%%23", new String[] { "mock" });
@@ -272,6 +428,15 @@ public class CharsetTest extends TestCase {
/*
* Test the constructor with null canonical name.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "Charset",
+ methodArgs = {java.lang.String.class, java.lang.String[].class}
+ )
+ })
public void testConstructor_NullCanonicalName() {
try {
MockCharset c = new MockCharset(null, new String[] { "mock" });
@@ -284,6 +449,27 @@ public class CharsetTest extends TestCase {
/*
* Test the constructor with null aliases.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "Charset",
+ methodArgs = {java.lang.String.class, java.lang.String[].class}
+ ), @TestTarget(
+ methodName = "name",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "displayName",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "displayName",
+ methodArgs = {java.util.Locale.class}
+ ), @TestTarget(
+ methodName = "aliases",
+ methodArgs = {}
+ )
+ })
public void testConstructor_NullAliases() {
MockCharset c = new MockCharset("mockChar", null);
assertEquals("mockChar", c.name());
@@ -295,6 +481,15 @@ public class CharsetTest extends TestCase {
/*
* Test the constructor with a null aliases.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "Charset",
+ methodArgs = {java.lang.String.class, java.lang.String[].class}
+ )
+ })
public void testConstructor_NullAliase() {
try {
new MockCharset("mockChar", new String[] { "mock", null });
@@ -307,6 +502,27 @@ public class CharsetTest extends TestCase {
/*
* Test the constructor with no aliases.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "Charset",
+ methodArgs = {java.lang.String.class, java.lang.String[].class}
+ ), @TestTarget(
+ methodName = "name",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "displayName",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "displayName",
+ methodArgs = {java.util.Locale.class}
+ ), @TestTarget(
+ methodName = "aliases",
+ methodArgs = {}
+ )
+ })
public void testConstructor_NoAliases() {
MockCharset c = new MockCharset("mockChar", new String[0]);
assertEquals("mockChar", c.name());
@@ -319,6 +535,15 @@ public class CharsetTest extends TestCase {
* Test the constructor with empty aliases.
*
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "Charset",
+ methodArgs = {java.lang.String.class, java.lang.String[].class}
+ )
+ })
public void testConstructor_EmptyAliases() {
try {
new MockCharset("mockChar", new String[] { "" });
@@ -333,6 +558,15 @@ public class CharsetTest extends TestCase {
* nor a letter.
*
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "Charset",
+ methodArgs = {java.lang.String.class, java.lang.String[].class}
+ )
+ })
public void testConstructor_IllegalAliases_Initial() {
try {
new MockCharset("mockChar", new String[] { "mock", "-123" });
@@ -345,6 +579,15 @@ public class CharsetTest extends TestCase {
* Test the constructor with illegal aliase, illegal character in the
* middle.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "Charset",
+ methodArgs = {java.lang.String.class, java.lang.String[].class}
+ )
+ })
public void testConstructor_IllegalAliases_Middle() {
try {
new MockCharset("mockChar", new String[] { "mock", "22##ab" });
@@ -364,6 +607,15 @@ public class CharsetTest extends TestCase {
* Test the method aliases() with multiple aliases. Most conditions have
* been tested in the testcases for the constructors.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "aliases",
+ methodArgs = {}
+ )
+ })
public void testAliases_Multiple() {
final String mockName = "mockChar1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.:-_";
MockCharset c = new MockCharset("mockChar", new String[] { "mock",
@@ -386,6 +638,15 @@ public class CharsetTest extends TestCase {
* Test the method aliases() with duplicate aliases, one same with its
* canonical name.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "aliases",
+ methodArgs = {}
+ )
+ })
public void testAliases_Duplicate() {
final String mockName = "mockChar1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.:-_";
MockCharset c = new MockCharset("mockChar", new String[] { "mockChar",
@@ -401,6 +662,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method canEncode(). Test the default return value.
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {}
+ )
+ })
public void testCanEncode() {
MockCharset c = new MockCharset("mock", null);
assertTrue(c.canEncode());
@@ -409,6 +679,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method isRegistered(). Test the default return value.
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "isRegistered",
+ methodArgs = {}
+ )
+ })
public void testIsRegistered() {
MockCharset c = new MockCharset("mock", null);
assertTrue(c.isRegistered());
@@ -417,6 +696,15 @@ public class CharsetTest extends TestCase {
/*
* The name() method has been tested by the testcases for the constructor.
*/
+@TestInfo(
+ level = TestLevel.TODO,
+ purpose = "Test is empty",
+ targets = {
+ @TestTarget(
+ methodName = "name",
+ methodArgs = {}
+ )
+ })
public void testName() {
// already covered by testConstructor_XXX series
}
@@ -425,6 +713,15 @@ public class CharsetTest extends TestCase {
* The displayName() method have been tested by the testcases for the
* constructor.
*/
+@TestInfo(
+ level = TestLevel.TODO,
+ purpose = "Test is empty",
+ targets = {
+ @TestTarget(
+ methodName = "displayName",
+ methodArgs = {}
+ )
+ })
public void testDisplayName() {
// already covered by testConstructor_XXX series
}
@@ -432,6 +729,15 @@ public class CharsetTest extends TestCase {
/*
* Test displayName(Locale) with null.
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "displayName",
+ methodArgs = {java.util.Locale.class}
+ )
+ })
public void testDisplayName_Locale_Null() {
MockCharset c = new MockCharset("mock", null);
assertEquals("mock", c.displayName(null));
@@ -440,6 +746,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method compareTo(Object) with normal conditions.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "compareTo",
+ methodArgs = {java.nio.charset.Charset.class}
+ )
+ })
public void testCompareTo_Normal() {
MockCharset c1 = new MockCharset("mock", null);
assertEquals(0, c1.compareTo(c1));
@@ -475,6 +790,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method compareTo(Object) with null param.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "compareTo",
+ methodArgs = {java.lang.Object.class}
+ )
+ })
public void testCompareTo_Null() {
MockCharset c1 = new MockCharset("mock", null);
try {
@@ -488,6 +812,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method compareTo(Object) with another kind of charset object.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "compareTo",
+ methodArgs = {java.nio.charset.Charset.class}
+ )
+ })
public void testCompareTo_DiffCharsetClass() {
MockCharset c1 = new MockCharset("mock", null);
MockCharset2 c2 = new MockCharset2("Mock", new String[] { "myname" });
@@ -498,6 +831,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method equals(Object) with null param.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "equals",
+ methodArgs = {java.lang.Object.class}
+ )
+ })
public void testEquals_Normal() {
MockCharset c1 = new MockCharset("mock", null);
MockCharset2 c2 = new MockCharset2("mock", null);
@@ -512,6 +854,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method equals(Object) with normal conditions.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "equals",
+ methodArgs = {java.lang.Object.class}
+ )
+ })
public void testEquals_Null() {
MockCharset c1 = new MockCharset("mock", null);
assertFalse(c1.equals(null));
@@ -520,6 +871,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method equals(Object) with another kind of charset object.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "equals",
+ methodArgs = {java.lang.Object.class}
+ )
+ })
public void testEquals_NonCharsetObject() {
MockCharset c1 = new MockCharset("mock", null);
assertFalse(c1.equals("test"));
@@ -528,6 +888,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method equals(Object) with another kind of charset object.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "equals",
+ methodArgs = {java.lang.Object.class}
+ )
+ })
public void testEquals_DiffCharsetClass() {
MockCharset c1 = new MockCharset("mock", null);
MockCharset2 c2 = new MockCharset2("mock", null);
@@ -538,6 +907,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method hashCode().
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "hashCode",
+ methodArgs = {}
+ )
+ })
public void testHashCode_DiffCharsetClass() {
MockCharset c1 = new MockCharset("mock", null);
assertEquals(c1.hashCode(), "mock".hashCode());
@@ -551,6 +929,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method encode(CharBuffer) under normal condition.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class}
+ )
+ })
public void testEncode_CharBuffer_Normal() throws Exception {
MockCharset c1 = new MockCharset("testEncode_CharBuffer_Normal_mock", null);
ByteBuffer bb = c1.encode(CharBuffer.wrap("abcdefg"));
@@ -562,6 +949,18 @@ public class CharsetTest extends TestCase {
/*
* Test the method encode(CharBuffer) with an unmappable char.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class}
+ ), @TestTarget(
+ methodName = "newEncoder",
+ methodArgs = {}
+ )
+ })
public void testEncode_CharBuffer_Unmappable() throws Exception {
Charset c1 = Charset.forName("iso8859-1");
ByteBuffer bb = c1.encode(CharBuffer.wrap("abcd\u5D14efg"));
@@ -573,6 +972,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method encode(CharBuffer) with null CharBuffer.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class}
+ )
+ })
public void testEncode_CharBuffer_NullCharBuffer() {
MockCharset c = new MockCharset("mock", null);
try {
@@ -586,6 +994,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method encode(CharBuffer) with null encoder.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class}
+ )
+ })
public void testEncode_CharBuffer_NullEncoder() {
MockCharset2 c = new MockCharset2("mock2", null);
try {
@@ -599,6 +1016,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method encode(String) under normal condition.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class}
+ )
+ })
public void testEncode_String_Normal() throws Exception {
MockCharset c1 = new MockCharset("testEncode_String_Normal_mock", null);
ByteBuffer bb = c1.encode("abcdefg");
@@ -610,6 +1036,18 @@ public class CharsetTest extends TestCase {
/*
* Test the method encode(String) with an unmappable char.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class}
+ ), @TestTarget(
+ methodName = "newEncoder",
+ methodArgs = {}
+ )
+ })
public void testEncode_String_Unmappable() throws Exception {
Charset c1 = Charset.forName("iso8859-1");
ByteBuffer bb = c1.encode("abcd\u5D14efg");
@@ -621,6 +1059,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method encode(String) with null CharBuffer.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class}
+ )
+ })
public void testEncode_String_NullString() {
MockCharset c = new MockCharset("mock", null);
try {
@@ -634,6 +1081,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method encode(String) with null encoder.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.nio.CharBuffer.class}
+ )
+ })
public void testEncode_String_NullEncoder() {
MockCharset2 c = new MockCharset2("mock2", null);
@@ -648,6 +1104,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method decode(ByteBuffer) under normal condition.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class}
+ )
+ })
public void testDecode_Normal() throws Exception {
MockCharset c1 = new MockCharset("mock", null);
CharBuffer cb = c1.decode(ByteBuffer.wrap("abcdefg"
@@ -660,6 +1125,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method decode(ByteBuffer) with a malformed input.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class}
+ )
+ })
public void testDecode_Malformed() throws Exception {
Charset c1 = Charset.forName("iso8859-1");
CharBuffer cb = c1.decode(ByteBuffer.wrap("abcd\u5D14efg"
@@ -672,6 +1146,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method decode(ByteBuffer) with null CharBuffer.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class}
+ )
+ })
public void testDecode_NullByteBuffer() {
MockCharset c = new MockCharset("mock", null);
try {
@@ -685,6 +1168,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method decode(ByteBuffer) with null encoder.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class}
+ )
+ })
public void testDecode_NullDecoder() {
MockCharset2 c = new MockCharset2("mock2", null);
try {
@@ -698,6 +1190,15 @@ public class CharsetTest extends TestCase {
/*
* Test the method toString().
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "toString",
+ methodArgs = {}
+ )
+ })
public void testToString() {
MockCharset c1 = new MockCharset("mock", null);
assertTrue(-1 != c1.toString().indexOf("mock"));
@@ -706,7 +1207,16 @@ public class CharsetTest extends TestCase {
/**
* @tests java.nio.charset.Charset#availableCharsets()
*/
- public void test_availableCharsets() throws Exception {
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "availableCharsets",
+ methodArgs = {}
+ )
+ })
+ public void _test_availableCharsets() throws Exception {
// regression test for Harmony-1051
ClassLoader originalClassLoader = Thread.currentThread()
.getContextClassLoader();
@@ -723,7 +1233,16 @@ public class CharsetTest extends TestCase {
/**
* @tests java.nio.charset.Charset#availableCharsets()
*/
- public void test_forNameLString() throws Exception {
+@TestInfo(
+ level = TestLevel.PARTIAL_OK,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "forName",
+ methodArgs = {java.lang.String.class}
+ )
+ })
+ public void _test_forNameLString() throws Exception {
// regression test for Harmony-1051
ClassLoader originalClassLoader = Thread.currentThread()
.getContextClassLoader();
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/CoderResultTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/CoderResultTest.java
index d362a57..1b4a92d 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/CoderResultTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/CoderResultTest.java
@@ -16,6 +16,11 @@
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
import java.nio.BufferOverflowException;
import java.nio.BufferUnderflowException;
import java.nio.charset.CoderResult;
@@ -23,7 +28,7 @@ import java.nio.charset.MalformedInputException;
import java.nio.charset.UnmappableCharacterException;
import junit.framework.TestCase;
-
+@TestTargetClass(CoderResult.class)
/**
* Test class java.nio.charset.CoderResult.
*/
@@ -46,6 +51,36 @@ public class CoderResultTest extends TestCase {
/*
* Test the constant OVERFLOW and UNDERFLOW.
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "isError",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "isMalformed",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "isOverflow",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "isUnderflow",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "isUnmappable",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "length",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "throwException",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "toString",
+ methodArgs = {}
+ )
+ })
public void testConstants() throws Exception {
assertNotSame(CoderResult.OVERFLOW, CoderResult.UNDERFLOW);
@@ -94,6 +129,21 @@ public class CoderResultTest extends TestCase {
* Test method isError().
*
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "isError",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "malformedForLength",
+ methodArgs = {int.class}
+ ), @TestTarget(
+ methodName = "unmappableForLength",
+ methodArgs = {int.class}
+ )
+ })
public void testIsError() {
assertFalse(CoderResult.UNDERFLOW.isError());
assertFalse(CoderResult.OVERFLOW.isError());
@@ -105,6 +155,21 @@ public class CoderResultTest extends TestCase {
* Test method isMalformed().
*
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "isMalformed",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "malformedForLength",
+ methodArgs = {int.class}
+ ), @TestTarget(
+ methodName = "unmappableForLength",
+ methodArgs = {int.class}
+ )
+ })
public void testIsMalformed() {
assertFalse(CoderResult.UNDERFLOW.isMalformed());
assertFalse(CoderResult.OVERFLOW.isMalformed());
@@ -116,6 +181,21 @@ public class CoderResultTest extends TestCase {
* Test method isMalformed().
*
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "isUnmappable",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "malformedForLength",
+ methodArgs = {int.class}
+ ), @TestTarget(
+ methodName = "unmappableForLength",
+ methodArgs = {int.class}
+ )
+ })
public void testIsUnmappable() {
assertFalse(CoderResult.UNDERFLOW.isUnmappable());
assertFalse(CoderResult.OVERFLOW.isUnmappable());
@@ -127,6 +207,21 @@ public class CoderResultTest extends TestCase {
* Test method isOverflow().
*
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "isOverflow",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "malformedForLength",
+ methodArgs = {int.class}
+ ), @TestTarget(
+ methodName = "unmappableForLength",
+ methodArgs = {int.class}
+ )
+ })
public void testIsOverflow() {
assertFalse(CoderResult.UNDERFLOW.isOverflow());
assertTrue(CoderResult.OVERFLOW.isOverflow());
@@ -138,6 +233,21 @@ public class CoderResultTest extends TestCase {
* Test method isUnderflow().
*
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "isUnderflow",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "malformedForLength",
+ methodArgs = {int.class}
+ ), @TestTarget(
+ methodName = "unmappableForLength",
+ methodArgs = {int.class}
+ )
+ })
public void testIsUnderflow() {
assertTrue(CoderResult.UNDERFLOW.isUnderflow());
assertFalse(CoderResult.OVERFLOW.isUnderflow());
@@ -149,6 +259,21 @@ public class CoderResultTest extends TestCase {
* Test method length().
*
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "length",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "malformedForLength",
+ methodArgs = {int.class}
+ ), @TestTarget(
+ methodName = "unmappableForLength",
+ methodArgs = {int.class}
+ )
+ })
public void testLength() {
try {
CoderResult.UNDERFLOW.length();
@@ -171,6 +296,15 @@ public class CoderResultTest extends TestCase {
* Test method malformedForLength(int).
*
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "malformedForLength",
+ methodArgs = {int.class}
+ )
+ })
public void testMalformedForLength() {
assertNotNull(CoderResult.malformedForLength(Integer.MAX_VALUE));
assertNotNull(CoderResult.malformedForLength(1));
@@ -198,6 +332,15 @@ public class CoderResultTest extends TestCase {
* Test method unmappableForLength(int).
*
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "unmappableForLength",
+ methodArgs = {int.class}
+ )
+ })
public void testUnmappableForLength() {
assertNotNull(CoderResult.unmappableForLength(Integer.MAX_VALUE));
assertNotNull(CoderResult.unmappableForLength(1));
@@ -223,6 +366,21 @@ public class CoderResultTest extends TestCase {
* Test method throwException().
*
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "throwException",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "malformedForLength",
+ methodArgs = {int.class}
+ ), @TestTarget(
+ methodName = "unmappableForLength",
+ methodArgs = {int.class}
+ )
+ })
public void testThrowException() throws Exception {
try {
CoderResult.OVERFLOW.throwException();
@@ -254,6 +412,21 @@ public class CoderResultTest extends TestCase {
* Test method toString().
*
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "toString",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "malformedForLength",
+ methodArgs = {int.class}
+ ), @TestTarget(
+ methodName = "unmappableForLength",
+ methodArgs = {int.class}
+ )
+ })
public void testToString() throws Exception {
assertTrue(CoderResult.OVERFLOW.toString().indexOf("OVERFLOW") != -1);
assertTrue(CoderResult.UNDERFLOW.toString().indexOf("UNDERFLOW") != -1);
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/CodingErrorActionTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/CodingErrorActionTest.java
index 1e23aef..5847fd1 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/CodingErrorActionTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/CodingErrorActionTest.java
@@ -16,10 +16,15 @@
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
import java.nio.charset.CodingErrorAction;
import junit.framework.TestCase;
-
+@TestTargetClass(CodingErrorAction.class)
/**
* Test class java.nio.charset.CodingErrorAction
*/
@@ -42,6 +47,15 @@ public class CodingErrorActionTest extends TestCase {
/*
* Test the constants.
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Verify constant",
+ targets = {
+ @TestTarget(
+ methodName = "!Constants",
+ methodArgs = {}
+ )
+ })
public void testIGNORE() {
assertNotNull(CodingErrorAction.IGNORE);
assertNotNull(CodingErrorAction.REPLACE);
@@ -54,6 +68,15 @@ public class CodingErrorActionTest extends TestCase {
/*
* Test the method toString().
*/
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "Verify constant",
+ targets = {
+ @TestTarget(
+ methodName = "toString",
+ methodArgs = {}
+ )
+ })
public void testToString() {
assertTrue(CodingErrorAction.IGNORE.toString().indexOf("IGNORE") != -1);
assertTrue(CodingErrorAction.REPLACE.toString().indexOf("REPLACE") != -1);
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/GBCharsetDecoderTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/GBCharsetDecoderTest.java
index 855e85b..63f5398 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/GBCharsetDecoderTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/GBCharsetDecoderTest.java
@@ -16,10 +16,13 @@
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
+@TestTargetClass(java.nio.charset.CharsetDecoder.class)
/**
* test gb18030 decoder
*/
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/GBCharsetEncoderTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/GBCharsetEncoderTest.java
index 6890b0c..4e30997 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/GBCharsetEncoderTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/GBCharsetEncoderTest.java
@@ -16,10 +16,16 @@
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
import java.nio.CharBuffer;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
+@TestTargetClass(java.nio.charset.CharsetEncoder.class)
/**
* test case specific activity of gb18030 charset encoder
*/
@@ -43,6 +49,15 @@ public class GBCharsetEncoderTest extends CharsetEncoderTest {
super.tearDown();
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {char.class}
+ )
+ })
public void testCanEncodechar() throws CharacterCodingException {
// normal case for utfCS
assertTrue(encoder.canEncode('\u0077'));
@@ -55,6 +70,15 @@ public class GBCharsetEncoderTest extends CharsetEncoderTest {
/*
* Class under test for boolean canEncode(CharSequence)
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {java.lang.CharSequence.class}
+ )
+ })
public void testCanEncodeCharSequence() {
assertTrue(encoder.canEncode(""));
// surrogate char
@@ -66,6 +90,18 @@ public class GBCharsetEncoderTest extends CharsetEncoderTest {
assertFalse(encoder.canEncode("\ud800"));
}
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "averageBytesPerChar",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "maxBytesPerChar",
+ methodArgs = {}
+ )
+ })
public void testSpecificDefaultValue() {
// FIXME: different here!
assertEquals(4.0, encoder.maxBytesPerChar(), 0.0);
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/ISOCharsetDecoderTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/ISOCharsetDecoderTest.java
index f1104cd..efb2539 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/ISOCharsetDecoderTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/ISOCharsetDecoderTest.java
@@ -16,6 +16,8 @@
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
@@ -23,6 +25,7 @@ import java.nio.charset.Charset;
/**
* test ISO-8859-1 decoder
*/
+@TestTargetClass(java.nio.charset.CharsetDecoder.class)
public class ISOCharsetDecoderTest extends CharsetDecoderTest {
protected void setUp() throws Exception {
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/ISOCharsetEncoderTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/ISOCharsetEncoderTest.java
index ea25929..af764c5 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/ISOCharsetEncoderTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/ISOCharsetEncoderTest.java
@@ -15,6 +15,11 @@
*/
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.CharacterCodingException;
@@ -26,6 +31,7 @@ import java.nio.charset.UnmappableCharacterException;
/**
* test case specific activity of iso-8859-1 charset encoder
*/
+@TestTargetClass(java.nio.charset.CharsetEncoder.class)
public class ISOCharsetEncoderTest extends CharsetEncoderTest {
// charset for iso-8859-1
@@ -46,6 +52,15 @@ public class ISOCharsetEncoderTest extends CharsetEncoderTest {
super.tearDown();
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {java.lang.CharSequence.class}
+ )
+ })
public void testCanEncodeCharSequence() {
// normal case for isoCS
assertTrue(encoder.canEncode("\u0077"));
@@ -58,16 +73,49 @@ public class ISOCharsetEncoderTest extends CharsetEncoderTest {
assertTrue(encoder.canEncode(""));
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Regression test. IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {char.class}
+ ), @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {java.lang.CharSequence.class}
+ )
+ })
public void testCanEncodeICUBug() {
assertFalse(encoder.canEncode((char) '\ud800'));
assertFalse(encoder.canEncode((String) "\ud800"));
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {char.class}
+ )
+ })
public void testCanEncodechar() throws CharacterCodingException {
assertTrue(encoder.canEncode('\u0077'));
assertFalse(encoder.canEncode('\uc2a3'));
}
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "averageBytesPerChar",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "maxBytesPerChar",
+ methodArgs = {}
+ )
+ })
public void testSpecificDefaultValue() {
assertEquals(1, encoder.averageBytesPerChar(), 0.001);
assertEquals(1, encoder.maxBytesPerChar(), 0.001);
@@ -89,6 +137,21 @@ public class ISOCharsetEncoderTest extends CharsetEncoderTest {
return null;
}
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "Checks also: flush & encode, but not covers exceptions.",
+ targets = {
+ @TestTarget(
+ methodName = "onMalformedInput",
+ methodArgs = {java.nio.charset.CodingErrorAction.class}
+ ), @TestTarget(
+ methodName = "onUnmappableCharacter",
+ methodArgs = {java.nio.charset.CodingErrorAction.class}
+ ), @TestTarget(
+ methodName = "reset",
+ methodArgs = {}
+ )
+ })
public void testMultiStepEncode() throws CharacterCodingException {
encoder.onMalformedInput(CodingErrorAction.REPORT);
encoder.onUnmappableCharacter(CodingErrorAction.REPORT);
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/ISOCharsetTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/ISOCharsetTest.java
index 5c010b2..562adc3 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/ISOCharsetTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/ISOCharsetTest.java
@@ -16,9 +16,15 @@
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
/**
* Test ISO-8859-1.
*/
+@TestTargetClass(java.nio.charset.Charset.class)
public class ISOCharsetTest extends AbstractCharsetTestCase {
/**
@@ -36,6 +42,15 @@ public class ISOCharsetTest extends AbstractCharsetTestCase {
*
* @see tests.api.java.nio.charset.ConcreteCharsetTest#testEncode_Normal()
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Functional test, text source: AbstractCharsetTestCase.internalTestEncode. Exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.lang.String.class}
+ )
+ })
public void testEncode_Normal() {
String input = "ab\u5D14\u654F";
byte[] output = new byte[] { 97, 98,
@@ -49,6 +64,15 @@ public class ISOCharsetTest extends AbstractCharsetTestCase {
*
* @see tests.api.java.nio.charset.ConcreteCharsetTest#testDecode_Normal()
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Functional test, text source: AbstractCharsetTestCase.internalTestDecode. Exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class}
+ )
+ })
public void testDecode_Normal() {
byte[] input = new byte[] { 97, 98, 63, 63 };
char[] output = "ab??".toCharArray();
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/UTF16BECharsetDecoderTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/UTF16BECharsetDecoderTest.java
index 9e2b66d..0a43e42 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/UTF16BECharsetDecoderTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/UTF16BECharsetDecoderTest.java
@@ -16,6 +16,8 @@
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
@@ -23,6 +25,8 @@ import java.nio.charset.Charset;
/**
*
*/
+
+@TestTargetClass(java.nio.charset.CharsetDecoder.class)
public class UTF16BECharsetDecoderTest extends CharsetDecoderTest {
protected void setUp() throws Exception {
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/UTF16BECharsetEncoderTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/UTF16BECharsetEncoderTest.java
index 194b3b3..4f05c46 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/UTF16BECharsetEncoderTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/UTF16BECharsetEncoderTest.java
@@ -16,6 +16,11 @@
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
import java.nio.CharBuffer;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
@@ -23,6 +28,7 @@ import java.nio.charset.Charset;
/**
* TODO type def
*/
+@TestTargetClass(java.nio.charset.CharsetEncoder.class)
public class UTF16BECharsetEncoderTest extends CharsetEncoderTest {
// charset for utf-16be
@@ -50,10 +56,28 @@ public class UTF16BECharsetEncoderTest extends CharsetEncoderTest {
super.tearDown();
}
+@TestInfo(
+ level = TestLevel.TODO,
+ purpose = "Empty test.",
+ targets = {
+ @TestTarget(
+ methodName = "CharsetEncoder",
+ methodArgs = {java.nio.charset.Charset.class, float.class, float.class}
+ )
+ })
public void testCharsetEncoderCharsetfloatfloat() {
// this constructor is invalid for UTF16LE CharsetEncoder
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {char.class}
+ )
+ })
public void testCanEncodechar() throws CharacterCodingException {
// normal case for utfCS
assertTrue(encoder.canEncode('\u0077'));
@@ -64,6 +88,15 @@ public class UTF16BECharsetEncoderTest extends CharsetEncoderTest {
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {java.lang.CharSequence.class}
+ )
+ })
public void testCanEncodeCharSequence() {
// normal case for utfCS
assertTrue(encoder.canEncode("\u0077"));
@@ -82,10 +115,28 @@ public class UTF16BECharsetEncoderTest extends CharsetEncoderTest {
assertFalse(encoder.canEncode("\ud800\udb00"));
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Regression test. IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {java.lang.CharSequence.class}
+ )
+ })
public void testCanEncodeICUBug() {
assertFalse(encoder.canEncode("\ud800"));
}
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "maxBytesPerChar",
+ methodArgs = {}
+ )
+ })
public void testSpecificDefaultValue() {
// ??? TODO NIO adapt to the actually used UTF16BE charset Encoder
// assertEquals(2, encoder.averageBytesPerChar(), 0.001);
@@ -104,6 +155,15 @@ public class UTF16BECharsetEncoderTest extends CharsetEncoderTest {
return null;
}
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "isLegalReplacement",
+ methodArgs = {byte[].class}
+ )
+ })
public void testIsLegalReplacementEmptyArray() {
assertTrue(encoder.isLegalReplacement(new byte[0]));
}
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/UTF16BECharsetTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/UTF16BECharsetTest.java
index 754afa3..353a08b 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/UTF16BECharsetTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/UTF16BECharsetTest.java
@@ -16,9 +16,15 @@
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
/**
* Test UTF-16BE.
*/
+@TestTargetClass(java.nio.charset.Charset.class)
public class UTF16BECharsetTest extends AbstractCharsetTestCase {
/**
@@ -34,6 +40,15 @@ public class UTF16BECharsetTest extends AbstractCharsetTestCase {
*
* @see tests.api.java.nio.charset.ConcreteCharsetTest#testEncode_Normal()
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Functional test, text source: AbstractCharsetTestCase.internalTestEncode. Exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.lang.String.class}
+ )
+ })
public void testEncode_Normal() {
String input = "ab\u5D14\u654F";
byte[] output = new byte[] { 0, 97, 0, 98, 93, 20, 101, 79 };
@@ -45,6 +60,15 @@ public class UTF16BECharsetTest extends AbstractCharsetTestCase {
*
* @see tests.api.java.nio.charset.ConcreteCharsetTest#testDecode_Normal()
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Functional test, text source: AbstractCharsetTestCase.internalTestDecode. Exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class}
+ )
+ })
public void testDecode_Normal() {
byte[] input = new byte[] { 0, 97, 0, 98, 93, 20, 101, 79 };
char[] output = "ab\u5D14\u654F".toCharArray();
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/UTF16CharsetDecoderTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/UTF16CharsetDecoderTest.java
index fa1d5ec..17fbfc5 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/UTF16CharsetDecoderTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/UTF16CharsetDecoderTest.java
@@ -16,6 +16,11 @@
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
@@ -27,6 +32,7 @@ import java.nio.charset.CodingErrorAction;
/**
*
*/
+@TestTargetClass(java.nio.charset.CharsetDecoder.class)
public class UTF16CharsetDecoderTest extends CharsetDecoderTest {
boolean bigEndian = true;
@@ -68,6 +74,15 @@ public class UTF16CharsetDecoderTest extends CharsetDecoderTest {
}
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class, java.nio.CharBuffer.class, boolean.class}
+ )
+ })
public void testMultiStepDecode() throws CharacterCodingException {
if (!cs.name().equals("mock")) {
decoder.onMalformedInput(CodingErrorAction.REPORT);
@@ -112,6 +127,18 @@ public class UTF16CharsetDecoderTest extends CharsetDecoderTest {
}
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Implementation in CharsetDecoderTest.implTestDecodeByteBufferCharBufferboolean & CharsetDecoderTest.implTestDecodeByteBuffer. Exceptions cheching missed.",
+ targets = {
+ @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class}
+ ), @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class, java.nio.CharBuffer.class, boolean.class}
+ )
+ })
public void testLittleEndian() throws CharacterCodingException,
UnsupportedEncodingException {
bigEndian = false;
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/UTF16CharsetEncoderTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/UTF16CharsetEncoderTest.java
index bdc505d..e0b4b7d 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/UTF16CharsetEncoderTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/UTF16CharsetEncoderTest.java
@@ -16,6 +16,11 @@
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.CharacterCodingException;
@@ -25,6 +30,7 @@ import java.nio.charset.CharsetDecoder;
/**
* TODO type def
*/
+@TestTargetClass(java.nio.charset.CharsetEncoder.class)
public class UTF16CharsetEncoderTest extends CharsetEncoderTest {
// charset for utf-16
@@ -54,10 +60,28 @@ public class UTF16CharsetEncoderTest extends CharsetEncoderTest {
super.tearDown();
}
+@TestInfo(
+ level = TestLevel.TODO,
+ purpose = "Test is empty",
+ targets = {
+ @TestTarget(
+ methodName = "CharsetEncoder",
+ methodArgs = {java.nio.charset.Charset.class, float.class, float.class}
+ )
+ })
public void testCharsetEncoderCharsetfloatfloat() {
// this constructor is invalid for UTF16LE CharsetEncoder
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {char.class}
+ )
+ })
public void testCanEncodechar() throws CharacterCodingException {
// normal case for utfCS
assertTrue(encoder.canEncode('\u0077'));
@@ -67,6 +91,15 @@ public class UTF16CharsetEncoderTest extends CharsetEncoderTest {
assertTrue(encoder.canEncode('\uc2c0'));
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {java.lang.CharSequence.class}
+ )
+ })
public void testCanEncodeCharSequence() {
// normal case for utfCS
assertTrue(encoder.canEncode("\u0077"));
@@ -85,11 +118,35 @@ public class UTF16CharsetEncoderTest extends CharsetEncoderTest {
assertFalse(encoder.canEncode("\ud800\udb00"));
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {char.class}
+ ), @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {java.lang.CharSequence.class}
+ )
+ })
public void testCanEncodeICUBug() {
assertFalse(encoder.canEncode('\ud800'));
assertFalse(encoder.canEncode("\ud800"));
}
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "averageBytesPerChar",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "maxBytesPerChar",
+ methodArgs = {}
+ )
+ })
public void testSpecificDefaultValue() {
assertEquals(encoder.averageBytesPerChar(), 2, 0.001);
// assertEquals(4, encoder.maxBytesPerChar());
@@ -109,6 +166,15 @@ public class UTF16CharsetEncoderTest extends CharsetEncoderTest {
return null;
}
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "isLegalReplacement",
+ methodArgs = {byte[].class}
+ )
+ })
public void testIsLegalReplacementEmptyArray() {
assertTrue(encoder.isLegalReplacement(new byte[0]));
}
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/UTF16CharsetTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/UTF16CharsetTest.java
index e77be5e..725e43a 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/UTF16CharsetTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/UTF16CharsetTest.java
@@ -16,9 +16,15 @@
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
/**
* Test UTF-16.
*/
+@TestTargetClass(java.nio.charset.Charset.class)
public class UTF16CharsetTest extends AbstractCharsetTestCase {
/**
@@ -33,6 +39,15 @@ public class UTF16CharsetTest extends AbstractCharsetTestCase {
*
* @see tests.api.java.nio.charset.ConcreteCharsetTest#testEncode_Normal()
*/
+ @TestInfo(
+ level = TestLevel.TODO,
+ purpose = "Empty test.",
+ targets = {
+ @TestTarget(
+ methodName = "",
+ methodArgs = {}
+ )
+ })
public void testEncode_Normal() {
// TODO Auto-generated method stub
@@ -43,6 +58,15 @@ public class UTF16CharsetTest extends AbstractCharsetTestCase {
*
* @see tests.api.java.nio.charset.ConcreteCharsetTest#testDecode_Normal()
*/
+ @TestInfo(
+ level = TestLevel.TODO,
+ purpose = "Empty test.",
+ targets = {
+ @TestTarget(
+ methodName = "",
+ methodArgs = {}
+ )
+ })
public void testDecode_Normal() {
// TODO Auto-generated method stub
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/UTF16LECharsetDecoderTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/UTF16LECharsetDecoderTest.java
index 183fa47..eed1b12 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/UTF16LECharsetDecoderTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/UTF16LECharsetDecoderTest.java
@@ -16,6 +16,11 @@
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
@@ -23,6 +28,7 @@ import java.nio.charset.Charset;
/**
* TODO typedef
*/
+@TestTargetClass(java.nio.charset.CharsetDecoder.class)
public class UTF16LECharsetDecoderTest extends CharsetDecoderTest {
protected void setUp() throws Exception {
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/UTF16LECharsetEncoderTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/UTF16LECharsetEncoderTest.java
index e669e11..003e1d7 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/UTF16LECharsetEncoderTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/UTF16LECharsetEncoderTest.java
@@ -16,6 +16,11 @@
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
import java.nio.CharBuffer;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
@@ -23,6 +28,7 @@ import java.nio.charset.Charset;
/**
* TODO type def
*/
+@TestTargetClass(java.nio.charset.CharsetEncoder.class)
public class UTF16LECharsetEncoderTest extends CharsetEncoderTest {
// charset for utf-16le
@@ -51,10 +57,28 @@ public class UTF16LECharsetEncoderTest extends CharsetEncoderTest {
super.tearDown();
}
+@TestInfo(
+ level = TestLevel.TODO,
+ purpose = "Empty constructor test.",
+ targets = {
+ @TestTarget(
+ methodName = "CharsetEncoder",
+ methodArgs = {java.nio.charset.Charset.class, float.class, float.class}
+ )
+ })
public void testCharsetEncoderCharsetfloatfloat() {
// this constructor is invalid for UTF16LE CharsetEncoder
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {char.class}
+ )
+ })
public void testCanEncodechar() throws CharacterCodingException {
// normal case for utfCS
assertTrue(encoder.canEncode('\u0077'));
@@ -64,6 +88,15 @@ public class UTF16LECharsetEncoderTest extends CharsetEncoderTest {
assertTrue(encoder.canEncode('\uc2c0'));
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {java.lang.CharSequence.class}
+ )
+ })
public void testCanEncodeCharSequence() {
// normal case for utfCS
assertTrue(encoder.canEncode("\u0077"));
@@ -82,15 +115,45 @@ public class UTF16LECharsetEncoderTest extends CharsetEncoderTest {
assertFalse(encoder.canEncode("\ud800\udb00"));
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Regression test. IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {java.lang.CharSequence.class}
+ )
+ })
public void testCanEncodeICUBug() {
assertFalse(encoder.canEncode("\ud800"));
}
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "averageBytesPerChar",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "maxBytesPerChar",
+ methodArgs = {}
+ )
+ })
public void testSpecificDefaultValue() {
assertEquals(2, encoder.averageBytesPerChar(), 0.001);
assertEquals(2, encoder.maxBytesPerChar(), 0.001);
}
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "isLegalReplacement",
+ methodArgs = {byte[].class}
+ )
+ })
public void testIsLegalReplacementEmptyArray() {
assertTrue(encoder.isLegalReplacement(new byte[0]));
}
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/UTF16LECharsetTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/UTF16LECharsetTest.java
index b32ab9b..5614eac 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/UTF16LECharsetTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/UTF16LECharsetTest.java
@@ -16,9 +16,16 @@
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
/**
* Test UTF-16LE.
*/
+
+@TestTargetClass(java.nio.charset.Charset.class)
public class UTF16LECharsetTest extends AbstractCharsetTestCase {
/**
@@ -34,6 +41,15 @@ public class UTF16LECharsetTest extends AbstractCharsetTestCase {
*
* @see tests.api.java.nio.charset.ConcreteCharsetTest#testEncode_Normal()
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Functional test, text source: AbstractCharsetTestCase.internalTestEncode. Exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.lang.String.class}
+ )
+ })
public void testEncode_Normal() {
String input = "ab\u5D14\u654F";
byte[] output = new byte[] { 97, 0, 98, 0, 20, 93, 79, 101 };
@@ -45,6 +61,15 @@ public class UTF16LECharsetTest extends AbstractCharsetTestCase {
*
* @see tests.api.java.nio.charset.ConcreteCharsetTest#testDecode_Normal()
*/
+ @TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Functional test, text source: AbstractCharsetTestCase.internalTestDecode. Exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class}
+ )
+ })
public void testDecode_Normal() {
byte[] input = new byte[] { 97, 0, 98, 0, 20, 93, 79, 101 };
char[] output = "ab\u5D14\u654F".toCharArray();
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/UTF8CharsetTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/UTF8CharsetTest.java
index 8e0f57f..cf22476 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/UTF8CharsetTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/UTF8CharsetTest.java
@@ -16,9 +16,15 @@
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
/**
* Test UTF-8 charset.
*/
+@TestTargetClass(java.nio.charset.Charset.class)
public class UTF8CharsetTest extends AbstractCharsetTestCase {
/**
@@ -34,6 +40,15 @@ public class UTF8CharsetTest extends AbstractCharsetTestCase {
*
* @see tests.api.java.nio.charset.ConcreteCharsetTest#testDecode_Normal()
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Functional test, text source: AbstractCharsetTestCase.internalTestDecode. Exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "decode",
+ methodArgs = {java.nio.ByteBuffer.class}
+ )
+ })
public void testDecode_Normal() {
byte[] input = new byte[] { 97, 98, -27, -76, -108, -26, -107, -113 };
char[] output = "ab\u5D14\u654F".toCharArray();
@@ -45,6 +60,15 @@ public class UTF8CharsetTest extends AbstractCharsetTestCase {
*
* @see tests.api.java.nio.charset.ConcreteCharsetTest#testEncode_Normal()
*/
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Functional test, text source: AbstractCharsetTestCase.internalTestEncode. Exceptions checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "encode",
+ methodArgs = {java.lang.String.class}
+ )
+ })
public void testEncode_Normal() {
String input = "ab\u5D14\u654F";
byte[] output = new byte[] { 97, 98, -27, -76, -108, -26, -107, -113 };
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/UTFCharsetDecoderTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/UTFCharsetDecoderTest.java
index 288cd16..16b52eb 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/UTFCharsetDecoderTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/UTFCharsetDecoderTest.java
@@ -16,6 +16,8 @@
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
@@ -23,6 +25,7 @@ import java.nio.charset.Charset;
/**
* test utf-8 decoder
*/
+@TestTargetClass(java.nio.charset.CharsetDecoder.class)
public class UTFCharsetDecoderTest extends CharsetDecoderTest {
protected void setUp() throws Exception {
diff --git a/nio_char/src/test/java/tests/api/java/nio/charset/UTFCharsetEncoderTest.java b/nio_char/src/test/java/tests/api/java/nio/charset/UTFCharsetEncoderTest.java
index b4f1e7d..a7c19d5 100644
--- a/nio_char/src/test/java/tests/api/java/nio/charset/UTFCharsetEncoderTest.java
+++ b/nio_char/src/test/java/tests/api/java/nio/charset/UTFCharsetEncoderTest.java
@@ -16,6 +16,11 @@
package tests.api.java.nio.charset;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestInfo;
+import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestLevel;
+
import java.nio.CharBuffer;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
@@ -23,6 +28,7 @@ import java.nio.charset.Charset;
/**
* test case specific activity of utf-8 charset encoder
*/
+@TestTargetClass(java.nio.charset.CharsetEncoder.class)
public class UTFCharsetEncoderTest extends CharsetEncoderTest {
// charset for UTF-8
@@ -44,6 +50,15 @@ public class UTFCharsetEncoderTest extends CharsetEncoderTest {
super.tearDown();
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {char.class}
+ )
+ })
public void testCanEncodechar() throws CharacterCodingException {
// normal case for utfCS
assertTrue(encoder.canEncode('\u0077'));
@@ -53,6 +68,15 @@ public class UTFCharsetEncoderTest extends CharsetEncoderTest {
assertTrue(encoder.canEncode('\uc2c0'));
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {java.lang.CharSequence.class}
+ )
+ })
public void testCanEncodeCharSequence() {
// normal case for utfCS
assertTrue(encoder.canEncode("\u0077"));
@@ -71,10 +95,31 @@ public class UTFCharsetEncoderTest extends CharsetEncoderTest {
assertFalse(encoder.canEncode("\ud800\udb00"));
}
+@TestInfo(
+ level = TestLevel.PARTIAL,
+ purpose = "Regression test. IllegalStateException checking missed.",
+ targets = {
+ @TestTarget(
+ methodName = "canEncode",
+ methodArgs = {java.lang.CharSequence.class}
+ )
+ })
public void testCanEncodeICUBug() {
assertFalse(encoder.canEncode("\ud800"));
}
+@TestInfo(
+ level = TestLevel.COMPLETE,
+ purpose = "",
+ targets = {
+ @TestTarget(
+ methodName = "averageBytesPerChar",
+ methodArgs = {}
+ ), @TestTarget(
+ methodName = "maxBytesPerChar",
+ methodArgs = {}
+ )
+ })
public void testSpecificDefaultValue() {
// assertEquals(1.1, encoder.averageBytesPerChar(), 0.0001);
assertEquals(2, encoder.averageBytesPerChar(), 0.0001);