diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-01-09 17:50:54 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-01-09 17:50:54 -0800 |
commit | a0881d052ee72e3f7e773374e9b1aa75fbd6be4c (patch) | |
tree | 8a9462436077d0d906368cb21f521f1bf8a25500 /logging | |
parent | dd828f42a5c83b4270d4fbf6fce2da1878f1e84a (diff) | |
download | libcore-a0881d052ee72e3f7e773374e9b1aa75fbd6be4c.zip libcore-a0881d052ee72e3f7e773374e9b1aa75fbd6be4c.tar.gz libcore-a0881d052ee72e3f7e773374e9b1aa75fbd6be4c.tar.bz2 |
auto import from //branches/cupcake/...@125939
Diffstat (limited to 'logging')
20 files changed, 3232 insertions, 3421 deletions
diff --git a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/AllTests.java b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/AllTests.java index 8c8baa1..1094f25 100644 --- a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/AllTests.java +++ b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/AllTests.java @@ -25,14 +25,14 @@ import junit.framework.TestSuite; public class AllTests { public static Test suite() { - TestSuite suite = new TestSuite( + TestSuite suite = tests.TestSuiteFactory.createTestSuite( "Suite for org.apache.harmony.logging.tests.java.util.logging"); // $JUnit-BEGIN$ suite.addTestSuite(ConsoleHandlerTest.class); suite.addTestSuite(ErrorManagerTest.class); suite.addTestSuite(FileHandlerTest.class); suite.addTestSuite(FilterTest.class); -// suite.addTestSuite(FormatterTest.class); + suite.addTestSuite(FormatterTest.class); suite.addTestSuite(HandlerTest.class); suite.addTestSuite(LevelTest.class); suite.addTestSuite(LoggerTest.class); diff --git a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/ConsoleHandlerTest.java b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/ConsoleHandlerTest.java index 188a138..91de2a5 100644 --- a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/ConsoleHandlerTest.java +++ b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/ConsoleHandlerTest.java @@ -18,9 +18,9 @@ package org.apache.harmony.logging.tests.java.util.logging; import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -82,16 +82,12 @@ public class ConsoleHandlerTest extends TestCase { /* * Test the constructor with no relevant log manager properties are set. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies the constructor with no relevant log manager " + - "properties are set.", - targets = { - @TestTarget( - methodName = "ConsoleHandler", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies the constructor with no relevant log manager properties are set.", + method = "ConsoleHandler", + args = {} + ) public void testConstructor_NoProperties() { assertNull(LogManager.getLogManager().getProperty( "java.util.logging.ConsoleHandler.level")); @@ -112,15 +108,12 @@ public class ConsoleHandlerTest extends TestCase { /* * Test the constructor with insufficient privilege. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies the constructor with insufficient privilege.", - targets = { - @TestTarget( - methodName = "ConsoleHandler", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies the constructor with insufficient privilege.", + method = "ConsoleHandler", + args = {} + ) public void testConstructor_InsufficientPrivilege() { assertNull(LogManager.getLogManager().getProperty( "java.util.logging.ConsoleHandler.level")); @@ -148,16 +141,12 @@ public class ConsoleHandlerTest extends TestCase { /* * Test the constructor with valid relevant log manager properties are set. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies the constructor with valid relevant log manager " + - "properties are set.", - targets = { - @TestTarget( - methodName = "ConsoleHandler", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies the constructor with valid relevant log manager properties are set.", + method = "ConsoleHandler", + args = {} + ) public void testConstructor_ValidProperties() throws Exception { Properties p = new Properties(); p.put("java.util.logging.ConsoleHandler.level", "FINE"); @@ -184,16 +173,12 @@ public class ConsoleHandlerTest extends TestCase { * Test the constructor with invalid relevant log manager properties are * set. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies the constructor with invalid relevant " + - "log manager properties are set.", - targets = { - @TestTarget( - methodName = "ConsoleHandler", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies the constructor with invalid relevant log manager properties are set.", + method = "ConsoleHandler", + args = {} + ) public void testConstructor_InvalidProperties() throws Exception { Properties p = new Properties(); p.put("java.util.logging.ConsoleHandler.level", INVALID_LEVEL); @@ -220,16 +205,12 @@ public class ConsoleHandlerTest extends TestCase { * Test close() when having sufficient privilege, and a record has been * written to the output stream. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies close() when having sufficient privilege, " + - "and a record has been written to the output stream.", - targets = { - @TestTarget( - methodName = "close", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies close() when having sufficient privilege, and a record has been written to the output stream.", + method = "close", + args = {} + ) public void testClose_SufficientPrivilege_NormalClose() throws Exception { Properties p = new Properties(); p.put("java.util.logging.ConsoleHandler.formatter", className @@ -250,16 +231,12 @@ public class ConsoleHandlerTest extends TestCase { * Test close() when having sufficient privilege, and an output stream that * always throws exceptions. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies close() when having sufficient privilege, " + - "and an output stream that always throws exceptions", - targets = { - @TestTarget( - methodName = "close", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies close() when having sufficient privilege, and an output stream that always throws exceptions", + method = "close", + args = {} + ) public void testClose_SufficientPrivilege_Exception() throws Exception { Properties p = new Properties(); p.put("java.util.logging.ConsoleHandler.formatter", className @@ -278,16 +255,12 @@ public class ConsoleHandlerTest extends TestCase { * Test close() when having sufficient privilege, and no record has been * written to the output stream. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Checks close() when having sufficient privilege, and no record " + - "has been written to the output stream", - targets = { - @TestTarget( - methodName = "close", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Checks close() when having sufficient privilege, and no record has been written to the output stream", + method = "close", + args = {} + ) public void testClose_SufficientPrivilege_DirectClose() throws Exception { Properties p = new Properties(); p.put("java.util.logging.ConsoleHandler.formatter", className @@ -306,15 +279,12 @@ public class ConsoleHandlerTest extends TestCase { /* * Test close() when having insufficient privilege. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies close() when insufficient privilege is set up.", - targets = { - @TestTarget( - methodName = "close", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies close() when insufficient privilege is set up.", + method = "close", + args = {} + ) public void testClose_InsufficientPrivilege() throws Exception { Properties p = new Properties(); p.put("java.util.logging.ConsoleHandler.formatter", className @@ -334,16 +304,12 @@ public class ConsoleHandlerTest extends TestCase { /* * Test publish(), use no filter, having output stream, normal log record. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies publish(), use no filter, having output stream, " + - "normal log record.", - targets = { - @TestTarget( - methodName = "publish", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies publish(), use no filter, having output stream, normal log record.", + method = "publish", + args = {java.util.logging.LogRecord.class} + ) public void testPublish_NoFilter() throws Exception { Properties p = new Properties(); p.put("java.util.logging.ConsoleHandler.formatter", className @@ -382,15 +348,12 @@ public class ConsoleHandlerTest extends TestCase { /* * Test publish(), after system err is reset. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies publish(), after system err is reset.", - targets = { - @TestTarget( - methodName = "publish", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies publish(), after system err is reset.", + method = "publish", + args = {java.util.logging.LogRecord.class} + ) public void testPublish_AfterResetSystemErr() throws Exception { Properties p = new Properties(); p.put("java.util.logging.ConsoleHandler.formatter", className @@ -413,16 +376,12 @@ public class ConsoleHandlerTest extends TestCase { /* * Test publish(), use a filter, having output stream, normal log record. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies publish(), use a filter, having output stream, " + - "normal log record.", - targets = { - @TestTarget( - methodName = "publish", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies publish(), use a filter, having output stream, normal log record.", + method = "publish", + args = {java.util.logging.LogRecord.class} + ) public void testPublish_WithFilter() throws Exception { Properties p = new Properties(); p.put("java.util.logging.ConsoleHandler.formatter", className @@ -464,17 +423,12 @@ public class ConsoleHandlerTest extends TestCase { * rather than throw exception, handler should call errormanager to handle * exception case, so NullPointerException shouldn't be thrown. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies publish(), null log record, having output stream, spec said " + - "rather than throw exception, handler should call errormanager to handle " + - "exception case, so NullPointerException shouldn't be thrown.", - targets = { - @TestTarget( - methodName = "publish", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies publish(), null log record, having output stream, spec said rather than throw exception, handler should call errormanager to handle exception case, so NullPointerException shouldn't be thrown.", + method = "publish", + args = {java.util.logging.LogRecord.class} + ) public void testPublish_Null() throws Exception { Properties p = new Properties(); p.put("java.util.logging.ConsoleHandler.formatter", className @@ -488,16 +442,12 @@ public class ConsoleHandlerTest extends TestCase { /* * Test publish(), a log record with empty msg, having output stream */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies publish(), a log record with empty msg, " + - "having output stream.", - targets = { - @TestTarget( - methodName = "publish", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies publish(), a log record with empty msg, having output stream.", + method = "publish", + args = {java.util.logging.LogRecord.class} + ) public void testPublish_EmptyMsg() throws Exception { Properties p = new Properties(); p.put("java.util.logging.ConsoleHandler.formatter", className @@ -514,15 +464,12 @@ public class ConsoleHandlerTest extends TestCase { /* * Test publish(), a log record with null msg, having output stream */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies publish(), a log record with null msg, having output stream.", - targets = { - @TestTarget( - methodName = "publish", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies publish(), a log record with null msg, having output stream.", + method = "publish", + args = {java.util.logging.LogRecord.class} + ) public void testPublish_NullMsg() throws Exception { Properties p = new Properties(); p.put("java.util.logging.ConsoleHandler.formatter", className @@ -536,15 +483,12 @@ public class ConsoleHandlerTest extends TestCase { // assertEquals("MockFormatter_Head", // this.errSubstituteStream.toString()); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies publish method after close.", - targets = { - @TestTarget( - methodName = "publish", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies publish method after close.", + method = "publish", + args = {java.util.logging.LogRecord.class} + ) public void testPublish_AfterClose() throws Exception { PrintStream backup = System.err; try { @@ -581,15 +525,12 @@ public class ConsoleHandlerTest extends TestCase { /* * Test setOutputStream() under normal condition. */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "Verifies setOutputStream() under normal condition.", - targets = { - @TestTarget( - methodName = "setOutputStream", - methodArgs = {java.io.OutputStream.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "Verifies setOutputStream() under normal condition.", + method = "setOutputStream", + args = {java.io.OutputStream.class} + ) public void testSetOutputStream_Normal() { MockStreamHandler h = new MockStreamHandler(); h.setFormatter(new MockFormatter()); diff --git a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/ErrorManagerTest.java b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/ErrorManagerTest.java index d2f2723..3185351 100644 --- a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/ErrorManagerTest.java +++ b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/ErrorManagerTest.java @@ -17,9 +17,9 @@ package org.apache.harmony.logging.tests.java.util.logging; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import junit.framework.TestCase; @@ -36,8 +36,9 @@ public class ErrorManagerTest extends TestCase { private final PrintStream err = System.err; + private final PrintStream out = System.out; - private OutputStream errSubstituteStream = null; + private OutputStream errSubstituteStream = null; public void setUp() throws Exception{ super.setUp(); @@ -47,19 +48,17 @@ public class ErrorManagerTest extends TestCase { public void tearDown() throws Exception{ System.setErr(err); + System.setOut(out); super.tearDown(); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies positive case only with ErrorManager.GENERIC_FAILURE, impove MockStream", - targets = { - @TestTarget( - methodName = "error", - methodArgs = {java.lang.String.class, java.lang.Exception.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies positive case only with ErrorManager.GENERIC_FAILURE, impove MockStream", + method = "error", + args = {java.lang.String.class, java.lang.Exception.class, int.class} + ) public void test_errorCheck() { ErrorManager em = new ErrorManager(); MockStream aos = new MockStream(); @@ -72,10 +71,12 @@ public class ErrorManagerTest extends TestCase { assertTrue("message appears (supertest)", aos.getWrittenData().indexOf("supertest") != -1); } - @TestInfo(level = TestLevel.PARTIAL_OK, - purpose = "Verifies positive case only with ErrorManager.GENERIC_FAILURE", - targets = {@TestTarget(methodName = "error", - methodArgs = { java.lang.String.class, java.lang.Exception.class, int.class})}) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies positive case only with ErrorManager.GENERIC_FAILURE", + method = "error", + args = {java.lang.String.class, java.lang.Exception.class, int.class} + ) public void test_errorStringStringint() { ErrorManager em = new ErrorManager(); em.error(null, new NullPointerException(), @@ -84,15 +85,12 @@ public class ErrorManagerTest extends TestCase { em.error(null, null, ErrorManager.GENERIC_FAILURE); } - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "ErrorManager", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "ErrorManager", + args = {} + ) public void test_constants() { assertEquals(3, ErrorManager.CLOSE_FAILURE); assertEquals(2, ErrorManager.FLUSH_FAILURE); diff --git a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FileHandlerTest.java b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FileHandlerTest.java index 445bd96..4334317 100644 --- a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FileHandlerTest.java +++ b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FileHandlerTest.java @@ -18,9 +18,9 @@ package org.apache.harmony.logging.tests.java.util.logging; import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; @@ -65,11 +65,14 @@ public class FileHandlerTest extends TestCase { final static SecurityManager securityManager = new MockLogSecurityManager(); - final static String HOMEPATH = System.getProperty("user.home"); + final static String SEP = File.separator; - final static String TEMPPATH = System.getProperty("java.io.tmpdir"); + private String oldHomePath = System.getProperty("user.home"); + + // The HOMEPATH can't be used in android. + final static String HOMEPATH = System.getProperty("java.io.tmpdir") + SEP + "home"; - final static String SEP = File.separator; + final static String TEMPPATH = System.getProperty("java.io.tmpdir"); private final PrintStream err = System.err; @@ -103,6 +106,17 @@ public class FileHandlerTest extends TestCase { props.put("java.util.logging.FileHandler.pattern", "%t/log/java%u.test"); + File home = new File(HOMEPATH); + if (!home.exists()) { + home.mkdirs(); + } else if (!home.isDirectory()) { + home.delete(); + home.mkdirs(); + } + if(!home.isDirectory()) { + fail("unable to create temp path"); + } + System.setProperty("user.home", HOMEPATH); File file = new File(TEMPPATH + SEP + "log"); file.mkdir(); @@ -125,39 +139,20 @@ public class FileHandlerTest extends TestCase { } reset(TEMPPATH + SEP + "log", ""); System.setErr(err); + System.setProperty("user.home", oldHomePath); + new File(HOMEPATH).delete(); super.tearDown(); } - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "Verifies getFormatter() method after close.", - targets = { - @TestTarget( - methodName = "getFormatter", - methodArgs = {} - ) - }) - public void _testLock() throws Exception { - FileOutputStream output = new FileOutputStream(TEMPPATH + SEP + "log" - + SEP + "java1.test.Lock"); - FileHandler h = new FileHandler(); - h.publish(r); - h.close(); - assertFileContent(TEMPPATH + SEP + "log", "java1.test.Lock", h.getFormatter()); - output.close(); - } /* * test for constructor void FileHandler() */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify exceptions.", - targets = { - @TestTarget( - methodName = "FileHandler", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify exceptions.", + method = "FileHandler", + args = {} + ) public void testFileHandler() throws Exception { assertEquals("character encoding is non equal to actual value", "iso-8859-1", handler.getEncoding()); @@ -183,15 +178,12 @@ public class FileHandlerTest extends TestCase { /* * test for constructor void FileHandler(String) */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify exceptions.", - targets = { - @TestTarget( - methodName = "FileHandler", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify security exception.", + method = "FileHandler", + args = {java.lang.String.class} + ) public void testFileHandler_1params() throws Exception { handler = new FileHandler("%t/log/string"); @@ -263,20 +255,24 @@ public class FileHandlerTest extends TestCase { .getFormatter()); file = new File(TEMPPATH + SEP + "log"); assertTrue("length list of file is incorrect", file.list().length <= 2); + + try { + new FileHandler(""); + fail("IllegalArgumentException expected"); + } catch (IllegalArgumentException e) { + //expected + } } /* * test for constructor void FileHandler(String pattern, boolean append) */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify exceptions.", - targets = { - @TestTarget( - methodName = "FileHandler", - methodArgs = {java.lang.String.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify security exception.", + method = "FileHandler", + args = {java.lang.String.class, boolean.class} + ) public void testFileHandler_2params() throws Exception { boolean append = false; do { @@ -307,21 +303,25 @@ public class FileHandlerTest extends TestCase { new LogRecord[] { r }, new MockFormatter()); } } while (append); + + try { + new FileHandler("", true); + fail("IllegalArgumentException expected"); + } catch (IllegalArgumentException e) { + //expected + } } /* * test for constructor void FileHandler(String pattern, int limit, int * count) */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify exceptions.", - targets = { - @TestTarget( - methodName = "FileHandler", - methodArgs = {java.lang.String.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verifysecurity exception.", + method = "FileHandler", + args = {java.lang.String.class, int.class, int.class} + ) public void testFileHandler_3params() throws Exception { int limit = 120; int count = 1; @@ -344,21 +344,39 @@ public class FileHandlerTest extends TestCase { } assertFileContent(TEMPPATH + SEP + "log", "/string", new LogRecord[] { r, null, r, null, r, null, r }, new MockFormatter()); + + try { + new FileHandler("", limit, count); + fail("IllegalArgumentException expected"); + } catch (IllegalArgumentException e) { + //expected + } + + try { + new FileHandler("%t/log/string", -1, count); + fail("IllegalArgumentException expected"); + } catch (IllegalArgumentException e) { + //expected + } + + try { + new FileHandler("%t/log/string", limit, 0); + fail("IllegalArgumentException expected"); + } catch (IllegalArgumentException e) { + //expected + } } /* * test for constructor public FileHandler(String pattern, int limit, int * count, boolean append) */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify exceptions.", - targets = { - @TestTarget( - methodName = "FileHandler", - methodArgs = {java.lang.String.class, int.class, int.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify security exception.", + method = "FileHandler", + args = {java.lang.String.class, int.class, int.class, boolean.class} + ) public void testFileHandler_4params() throws Exception { int limit = 120; int count = 1; @@ -391,30 +409,58 @@ public class FileHandlerTest extends TestCase { new LogRecord[] { r }, new MockFormatter()); } } while (append); + + try { + new FileHandler("", limit, count, true); + fail("IllegalArgumentException expected"); + } catch (IllegalArgumentException e) { + //expected + } + + try { + new FileHandler("%t/log/string", -1, count, false); + fail("IllegalArgumentException expected"); + } catch (IllegalArgumentException e) { + //expected + } + + try { + new FileHandler("%t/log/string", limit, 0, true); + fail("IllegalArgumentException expected"); + } catch (IllegalArgumentException e) { + //expected + } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "", - targets = { - @TestTarget( - methodName = "getEncoding", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getEncoding", + args = {} ), - @TestTarget( - methodName = "getFilter", - methodArgs = {} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getFilter", + args = {} ), - @TestTarget( - methodName = "getFormatter", - methodArgs = {} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getFormatter", + args = {} ), - @TestTarget( - methodName = "getLevel", - methodArgs = {} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getLevel", + args = {} ), - @TestTarget( - methodName = "getErrorManager", - methodArgs = {} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getErrorManager", + args = {} ) }) public void testDefaultValue() throws Exception { @@ -521,15 +567,12 @@ public class FileHandlerTest extends TestCase { e.printStackTrace(); } } - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "FileHandler", - methodArgs = {java.lang.String.class, int.class, int.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "FileHandler", + args = {java.lang.String.class, int.class, int.class, boolean.class} + ) public void testLimitAndCount() throws Exception { handler.close(); // very small limit value, count=2 @@ -590,6 +633,8 @@ public class FileHandlerTest extends TestCase { assertFileContent(TEMPPATH, "testLimitCount0.0", new LogRecord[] { rs[9] }, handler.getFormatter()); + String oldUserDir = System.getProperty("user.dir"); + System.setProperty("user.dir", System.getProperty("java.io.tmpdir")); FileHandler h1 = null; FileHandler h2 = null; try { @@ -610,31 +655,45 @@ public class FileHandlerTest extends TestCase { } catch (Exception e) { } reset("log", ""); + System.setProperty("user.dir", oldUserDir); } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "", - targets = { - @TestTarget( - methodName = "FileHandler", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "close", + args = {} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "FileHandler", + args = {} ), - @TestTarget( - methodName = "FileHandler", - methodArgs = {java.lang.String.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "FileHandler", + args = {java.lang.String.class} ), - @TestTarget( - methodName = "FileHandler", - methodArgs = {java.lang.String.class, boolean.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "FileHandler", + args = {java.lang.String.class, boolean.class} ), - @TestTarget( - methodName = "FileHandler", - methodArgs = {java.lang.String.class, int.class, int.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "FileHandler", + args = {java.lang.String.class, int.class, int.class} ), - @TestTarget( - methodName = "FileHandler", - methodArgs = {java.lang.String.class, int.class, int.class, boolean.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "FileHandler", + args = {java.lang.String.class, int.class, int.class, boolean.class} ) }) public void testSecurity() throws IOException { @@ -647,8 +706,8 @@ public class FileHandlerTest extends TestCase { fail("should throw security exception"); } catch (SecurityException e) { } - handler.publish(new LogRecord(Level.SEVERE, "msg")); + try { handler = new FileHandler(); fail("should throw security exception"); @@ -680,33 +739,42 @@ public class FileHandlerTest extends TestCase { } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies SecurityException.", - targets = { - @TestTarget( - methodName = "close", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies SecurityException.", + method = "close", + args = {} ), - @TestTarget( - methodName = "FileHandler", - methodArgs = {} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies SecurityException.", + method = "FileHandler", + args = {} ), - @TestTarget( - methodName = "FileHandler", - methodArgs = {java.lang.String.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies SecurityException.", + method = "FileHandler", + args = {java.lang.String.class} ), - @TestTarget( - methodName = "FileHandler", - methodArgs = {java.lang.String.class, boolean.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies SecurityException.", + method = "FileHandler", + args = {java.lang.String.class, boolean.class} ), - @TestTarget( - methodName = "FileHandler", - methodArgs = {java.lang.String.class, int.class, int.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies SecurityException.", + method = "FileHandler", + args = {java.lang.String.class, int.class, int.class} ), - @TestTarget( - methodName = "FileHandler", - methodArgs = {java.lang.String.class, int.class, int.class, boolean.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies SecurityException.", + method = "FileHandler", + args = {java.lang.String.class, int.class, int.class, boolean.class} ) }) public void testFileSecurity() throws IOException { @@ -751,15 +819,12 @@ public class FileHandlerTest extends TestCase { System.setSecurityManager(currentManager); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies FileHandler when configuration file is invalid.", - targets = { - @TestTarget( - methodName = "FileHandler", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies FileHandler when configuration file is invalid.", + method = "FileHandler", + args = {} + ) public void testInvalidProperty() throws Exception { props.put("java.util.logging.FileHandler.level", "null"); props.put("java.util.logging.FileHandler.filter", className @@ -794,29 +859,33 @@ public class FileHandlerTest extends TestCase { } catch (NullPointerException e) { } } - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "Verifies illegal parameters and exceptions: " + - "IOException, NullPointerException, IllegalArgumentException.", - targets = { - @TestTarget( - methodName = "FileHandler", - methodArgs = {java.lang.String.class} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies illegal parameters and exceptions: IOException, NullPointerException, IllegalArgumentException.", + method = "FileHandler", + args = {java.lang.String.class} ), - @TestTarget( - methodName = "FileHandler", - methodArgs = {java.lang.String.class, boolean.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies illegal parameters and exceptions: IOException, NullPointerException, IllegalArgumentException.", + method = "FileHandler", + args = {java.lang.String.class, boolean.class} ), - @TestTarget( - methodName = "FileHandler", - methodArgs = {java.lang.String.class, int.class, int.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies illegal parameters and exceptions: IOException, NullPointerException, IllegalArgumentException.", + method = "FileHandler", + args = {java.lang.String.class, int.class, int.class} ), - @TestTarget( - methodName = "publish", - methodArgs = {java.util.logging.LogRecord.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies illegal parameters and exceptions: IOException, NullPointerException, IllegalArgumentException.", + method = "publish", + args = {java.util.logging.LogRecord.class} ) }) - public void _testInvalidParams() throws IOException { + public void testInvalidParams() throws IOException { // %t and %p parsing can add file separator automatically FileHandler h1 = new FileHandler("%taaa"); @@ -825,12 +894,6 @@ public class FileHandlerTest extends TestCase { assertTrue(file.exists()); reset(TEMPPATH, "aaa"); - // always parse special pattern - try { - h1 = new FileHandler("%t/%h"); - } catch (Exception e) { - fail("Unexpected exception " + e.toString()); - } h1 = new FileHandler("%t%g"); h1.close(); file = new File(TEMPPATH + SEP + "0"); @@ -865,7 +928,7 @@ public class FileHandlerTest extends TestCase { file = new File(TEMPPATH + SEP + "baddir" + SEP + "multi0"); assertFalse(file.exists()); - // bad directory, IOException, append + // bad directory, IOException, append try { h1 = new FileHandler("%t/baddir/multi%g", true); fail("should throw IO exception"); @@ -935,20 +998,25 @@ public class FileHandlerTest extends TestCase { fail("should throw IllegalArgumentException"); } catch (IllegalArgumentException e) { } + + // always parse special pattern + System.setProperty("user.home", "home"); + try { + h1 = new FileHandler("%t/%h.txt"); + } catch (Exception e) { + fail("Unexpected exception " + e.toString()); + } } /* * test for method public void publish(LogRecord record) */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "publish", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "publish", + args = {java.util.logging.LogRecord.class} + ) public void testPublish() throws Exception { LogRecord[] r = new LogRecord[] { new LogRecord(Level.CONFIG, "msg__"), new LogRecord(Level.WARNING, "message"), @@ -966,15 +1034,12 @@ public class FileHandlerTest extends TestCase { /* * test for method public void close() */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "close", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "close", + args = {} + ) public void testClose() throws Exception { FileHandler h = new FileHandler("%t/log/stringPublish"); h.publish(r); @@ -982,15 +1047,12 @@ public class FileHandlerTest extends TestCase { assertFileContent(TEMPPATH + SEP + "log", "stringPublish", h .getFormatter()); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify SecurityException.", - targets = { - @TestTarget( - methodName = "setOutputStream", - methodArgs = {java.io.OutputStream.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify SecurityException.", + method = "setOutputStream", + args = {java.io.OutputStream.class} + ) // set output stream still works, just like super StreamHandler public void testSetOutputStream() throws Exception { MockFileHandler handler = new MockFileHandler("%h/setoutput.log"); @@ -1007,15 +1069,12 @@ public class FileHandlerTest extends TestCase { assertFileContent(HOMEPATH, "setoutput.log", handler.getFormatter()); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies IllegalArgumentException.", - targets = { - @TestTarget( - methodName = "FileHandler", - methodArgs = {java.lang.String.class, int.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies IllegalArgumentException.", + method = "FileHandler", + args = {java.lang.String.class, int.class, int.class} + ) public void testEmptyPattern_3params() throws SecurityException, IOException { try { @@ -1025,15 +1084,12 @@ public class FileHandlerTest extends TestCase { // Expected } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies IllegalArgumentException.", - targets = { - @TestTarget( - methodName = "FileHandler", - methodArgs = {java.lang.String.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies IllegalArgumentException.", + method = "FileHandler", + args = {java.lang.String.class, boolean.class} + ) public void testEmptyPattern_2params() throws SecurityException, IOException { try { @@ -1043,15 +1099,12 @@ public class FileHandlerTest extends TestCase { // Expected } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies IllegalArgumentException.", - targets = { - @TestTarget( - methodName = "FileHandler", - methodArgs = {java.lang.String.class, int.class, int.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies IllegalArgumentException.", + method = "FileHandler", + args = {java.lang.String.class, int.class, int.class, boolean.class} + ) public void testEmptyPattern_4params() throws SecurityException, IOException { try { diff --git a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FilterTest.java b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FilterTest.java index 3c82d70..d7ce843 100644 --- a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FilterTest.java +++ b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FilterTest.java @@ -31,9 +31,9 @@ package org.apache.harmony.logging.tests.java.util.logging; import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import java.util.logging.Filter; import java.util.logging.LogRecord; @@ -46,15 +46,12 @@ import junit.framework.TestCase; */ @TestTargetClass(Filter.class) public class FilterTest extends TestCase { - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "Verifies interface.", - targets = { - @TestTarget( - methodName = "isLoggable", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "Verifies interface.", + method = "isLoggable", + args = {java.util.logging.LogRecord.class} + ) public void testFilter() { MockFilter f = new MockFilter(); assertFalse(f.isLoggable(null)); diff --git a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FormatterTest.java b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FormatterTest.java index d8b6def..c1afeca 100644 --- a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FormatterTest.java +++ b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FormatterTest.java @@ -18,20 +18,27 @@ package org.apache.harmony.logging.tests.java.util.logging; import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargets; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestLevel; +import java.io.File; import java.text.MessageFormat; import java.util.Locale; +import java.util.Properties; import java.util.ResourceBundle; import java.util.logging.FileHandler; import java.util.logging.Formatter; +import java.util.logging.Handler; import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.logging.LogManager; import java.util.logging.LogRecord; import junit.framework.TestCase; +import org.apache.harmony.logging.tests.java.util.logging.util.EnvironmentHelper; + @TestTargetClass(Formatter.class) public class FormatterTest extends TestCase { Formatter f; @@ -42,75 +49,89 @@ public class FormatterTest extends TestCase { static String MSG = "msg, pls. ignore it"; + static LogManager manager = LogManager.getLogManager(); + + final static Properties props = new Properties(); + + final static String className = FormatterTest.class.getName(); + + final static String TEMPPATH = System.getProperty("java.io.tmpdir"); + + final static String SEP = File.separator; + /* * @see TestCase#setUp() */ protected void setUp() throws Exception { super.setUp(); + manager.reset(); + + //initProp + props.clear(); + props.put("java.util.logging.FileHandler.level", "FINE"); + props.put("java.util.logging.FileHandler.filter", className + + "$MockFilter"); + props.put("java.util.logging.FileHandler.formatter", className + + "$MockFormatter"); + props.put("java.util.logging.FileHandler.encoding", "iso-8859-1"); + // limit to only two message + props.put("java.util.logging.FileHandler.limit", "1000"); + // rotation count is 2 + props.put("java.util.logging.FileHandler.count", "2"); + // using append mode + props.put("java.util.logging.FileHandler.append", "true"); + props.put("java.util.logging.FileHandler.pattern", + "%t/log/java%u.test"); + + File file = new File(TEMPPATH + SEP + "log"); + file.mkdir(); + manager.readConfiguration(EnvironmentHelper + .PropertiesToInputStream(props)); + f = new MockFormatter(); r = new LogRecord(Level.FINE, MSG); h = new FileHandler(); - } /* * test for constructor protected Formatter() */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "Formatter", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "Formatter", + args = {} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getHead", + args = {java.util.logging.Handler.class} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getTail", + args = {java.util.logging.Handler.class} ) }) - public void _testFormatter() { - Formatter formatter; - formatter = new MockFormatter(); - assertEquals("head string is not empty", "", formatter.getHead(null)); - assertEquals("tail string is not empty", "", formatter.getTail(null)); + public void testFormatter() { + assertEquals("head string is not empty", "", f.getHead(null)); + assertEquals("tail string is not empty", "", f.getTail(null)); } - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "Abstract method.", - targets = { - @TestTarget( - methodName = "format", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) - public void _testFormat() { - assertEquals("format", f.format(r)); - } - - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "", - targets = { - @TestTarget( - methodName = "format", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) - public void _testFormatNull() { - assertEquals("format",f.format(null)); - } /* * test for method public String getHead(Handler h) */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "getHead", - methodArgs = {java.util.logging.Handler.class} - ) - }) - public void _testGetHead() { + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getHead", + args = {Handler.class} + ) + public void testGetHead() { assertEquals("head string is not empty", "", f.getHead(null)); assertEquals("head string is not empty", "", f.getHead(h)); h.publish(r); @@ -120,31 +141,26 @@ public class FormatterTest extends TestCase { /* * test for method public String getTail(Handler h) */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "getTail", - methodArgs = {java.util.logging.Handler.class} - ) - }) - public void _testGetTail() { + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getTail", + args = {Handler.class} + ) + public void testGetTail() { assertEquals("tail string is not empty", "", f.getTail(null)); assertEquals("tail string is not empty", "", f.getTail(h)); h.publish(r); assertEquals("tail string is not empty", "", f.getTail(h)); } - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "formatMessage", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) - public void _testFormatMessage() { + + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "formatMessage", + args = {LogRecord.class} + ) + public void testFormatMessage() { assertEquals(MSG, f.formatMessage(r)); String pattern = "test formatter {0, number}"; @@ -155,7 +171,7 @@ public class FormatterTest extends TestCase { r.setParameters(oa); assertEquals(pattern, f.formatMessage(r)); - oa = new Object[] { new Integer(100), new Float(1.1) }; + oa = new Object[] { new Integer(100), new Float(1.2), new Float(2.2) }; r.setParameters(oa); assertEquals(MessageFormat.format(pattern, oa), f.formatMessage(r)); @@ -166,28 +182,26 @@ public class FormatterTest extends TestCase { r.setMessage(pattern); assertEquals(pattern, f.formatMessage(r)); - pattern = "pattern without 0 {1, number}"; - r.setMessage(pattern); - assertEquals(MessageFormat.format(pattern, oa), f.formatMessage(r)); - pattern = null; r.setMessage(pattern); assertNull(f.formatMessage(r)); - - - assertNull(f.formatMessage(null)); - + + // The RI fails in this test because it uses a MessageFormat to format + // the message even though it doesn't contain "{0". The spec says that + // this would indicate that a MessageFormat should be used and else no + // formatting should be done. + pattern = "pattern without 0 {1, number}"; + r.setMessage(pattern); + assertEquals(pattern, f.formatMessage(r)); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "", - targets = { - @TestTarget( - methodName = "formatMessage", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) - public void _testLocalizedFormatMessage() { + + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "formatMessage", + args = {LogRecord.class} + ) + public void testLocalizedFormatMessage() { // normal case r.setMessage("msg"); ResourceBundle rb = ResourceBundle diff --git a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/HandlerTest.java b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/HandlerTest.java index d3edc45..0b882f0 100644 --- a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/HandlerTest.java +++ b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/HandlerTest.java @@ -18,8 +18,8 @@ package org.apache.harmony.logging.tests.java.util.logging; import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargets; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestLevel; import java.io.IOException; @@ -77,15 +77,12 @@ public class HandlerTest extends TestCase { /* * Test the constructor. */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "Handler", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "Handler", + args = {} + ) public void testConstructor() { MockHandler h = new MockHandler(); assertSame(h.getLevel(), Level.ALL); @@ -98,15 +95,12 @@ public class HandlerTest extends TestCase { /* * Test the constructor, with properties set */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "Handler", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "Handler", + args = {} + ) public void testConstructor_Properties() throws Exception { Properties p = new Properties(); p.put("java.util.logging.MockHandler.level", "FINE"); @@ -132,70 +126,20 @@ public class HandlerTest extends TestCase { } /* - * Abstract method, no test needed. - */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "Abstract method.", - targets = { - @TestTarget( - methodName = "close", - methodArgs = {} - ) - }) - public void testClose() { - MockHandler h = new MockHandler(); - h.close(); - } - - /* - * Abstract method, no test needed. - */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "Abstract method.", - targets = { - @TestTarget( - methodName = "flush", - methodArgs = {} - ) - }) - public void testFlush() { - MockHandler h = new MockHandler(); - h.flush(); - } - - /* - * Abstract method, no test needed. - */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "Abstract method.", - targets = { - @TestTarget( - methodName = "publish", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) - public void testPublish() { - MockHandler h = new MockHandler(); - h.publish(null); - } - - /* * Test getEncoding & setEncoding methods with supported encoding. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify exceptions.", - targets = { - @TestTarget( - methodName = "getEncoding", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify exceptions.", + method = "getEncoding", + args = {} ), - @TestTarget( - methodName = "setEncoding", - methodArgs = {java.lang.String.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify exceptions.", + method = "setEncoding", + args = {java.lang.String.class} ) }) public void testGetSetEncoding_Normal() throws Exception { @@ -207,15 +151,12 @@ public class HandlerTest extends TestCase { /* * Test getEncoding & setEncoding methods with null. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies null as a parameter.", - targets = { - @TestTarget( - methodName = "getEncoding", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies null as a parameter.", + method = "getEncoding", + args = {} + ) public void testGetSetEncoding_Null() throws Exception { MockHandler h = new MockHandler(); h.setEncoding(null); @@ -225,15 +166,12 @@ public class HandlerTest extends TestCase { /* * Test getEncoding & setEncoding methods with unsupported encoding. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies UnsupportedEncodingException.", - targets = { - @TestTarget( - methodName = "setEncoding", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies UnsupportedEncodingException.", + method = "setEncoding", + args = {java.lang.String.class} + ) public void testGetSetEncoding_Unsupported() { MockHandler h = new MockHandler(); try { @@ -247,15 +185,12 @@ public class HandlerTest extends TestCase { /* * Test setEncoding with insufficient privilege. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify UnsupportedEncodingException.", - targets = { - @TestTarget( - methodName = "setEncoding", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify UnsupportedEncodingException.", + method = "setEncoding", + args = {java.lang.String.class} + ) public void testSetEncoding_InsufficientPrivilege() throws Exception { MockHandler h = new MockHandler(); SecurityManager oldMan = System.getSecurityManager(); @@ -285,17 +220,18 @@ public class HandlerTest extends TestCase { /* * Test getErrorManager & setErrorManager methods with non-null value. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "", - targets = { - @TestTarget( - methodName = "setErrorManager", - methodArgs = {java.util.logging.ErrorManager.class} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "setErrorManager", + args = {java.util.logging.ErrorManager.class} ), - @TestTarget( - methodName = "getErrorManager", - methodArgs = {} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getErrorManager", + args = {} ) }) public void testGetSetErrorManager_Normal() throws Exception { @@ -308,17 +244,18 @@ public class HandlerTest extends TestCase { /* * Test getErrorManager & setErrorManager methods with null. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies null as a parameter.", - targets = { - @TestTarget( - methodName = "getErrorManager", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies null as a parameter.", + method = "getErrorManager", + args = {} ), - @TestTarget( - methodName = "setErrorManager", - methodArgs = {java.util.logging.ErrorManager.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies null as a parameter.", + method = "setErrorManager", + args = {java.util.logging.ErrorManager.class} ) }) public void testGetSetErrorManager_Null() throws Exception { @@ -342,15 +279,12 @@ public class HandlerTest extends TestCase { /* * Test getErrorManager with insufficient privilege. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies SecurityException.", - targets = { - @TestTarget( - methodName = "getErrorManager", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies SecurityException.", + method = "getErrorManager", + args = {} + ) public void testGetErrorManager_InsufficientPrivilege() throws Exception { MockHandler h = new MockHandler(); SecurityManager oldMan = System.getSecurityManager(); @@ -368,15 +302,12 @@ public class HandlerTest extends TestCase { /* * Test setErrorManager with insufficient privilege. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies setErrorManager with insufficient privilege.", - targets = { - @TestTarget( - methodName = "setErrorManager", - methodArgs = {java.util.logging.ErrorManager.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies setErrorManager with insufficient privilege.", + method = "setErrorManager", + args = {java.util.logging.ErrorManager.class} + ) public void testSetErrorManager_InsufficientPrivilege() throws Exception { MockHandler h = new MockHandler(); SecurityManager oldMan = System.getSecurityManager(); @@ -406,17 +337,18 @@ public class HandlerTest extends TestCase { /* * Test getFilter & setFilter methods with non-null value. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify SecurityException.", - targets = { - @TestTarget( - methodName = "setFilter", - methodArgs = {java.util.logging.Filter.class} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify SecurityException.", + method = "setFilter", + args = {java.util.logging.Filter.class} ), - @TestTarget( - methodName = "getFilter", - methodArgs = {} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify SecurityException.", + method = "getFilter", + args = {} ) }) public void testGetSetFilter_Normal() throws Exception { @@ -429,17 +361,18 @@ public class HandlerTest extends TestCase { /* * Test getFilter & setFilter methods with null. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies null as a parameter.", - targets = { - @TestTarget( - methodName = "getFilter", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies null as a parameter.", + method = "getFilter", + args = {} ), - @TestTarget( - methodName = "setFilter", - methodArgs = {java.util.logging.Filter.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies null as a parameter.", + method = "setFilter", + args = {java.util.logging.Filter.class} ) }) public void testGetSetFilter_Null() throws Exception { @@ -455,15 +388,12 @@ public class HandlerTest extends TestCase { /* * Test setFilter with insufficient privilege. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies SecurityException.", - targets = { - @TestTarget( - methodName = "setFilter", - methodArgs = {java.util.logging.Filter.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies SecurityException.", + method = "setFilter", + args = {java.util.logging.Filter.class} + ) public void testSetFilter_InsufficientPrivilege() throws Exception { MockHandler h = new MockHandler(); SecurityManager oldMan = System.getSecurityManager(); @@ -493,17 +423,18 @@ public class HandlerTest extends TestCase { /* * Test getFormatter & setFormatter methods with non-null value. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify SecurityException.", - targets = { - @TestTarget( - methodName = "getFormatter", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify SecurityException.", + method = "getFormatter", + args = {} ), - @TestTarget( - methodName = "setFormatter", - methodArgs = {java.util.logging.Formatter.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify SecurityException.", + method = "setFormatter", + args = {java.util.logging.Formatter.class} ) }) public void testGetSetFormatter_Normal() throws Exception { @@ -516,17 +447,18 @@ public class HandlerTest extends TestCase { /* * Test getFormatter & setFormatter methods with null. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies null as a parameter.", - targets = { - @TestTarget( - methodName = "getFormatter", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies null as a parameter.", + method = "getFormatter", + args = {} ), - @TestTarget( - methodName = "setFormatter", - methodArgs = {java.util.logging.Formatter.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies null as a parameter.", + method = "setFormatter", + args = {java.util.logging.Formatter.class} ) }) public void testGetSetFormatter_Null() throws Exception { @@ -550,15 +482,12 @@ public class HandlerTest extends TestCase { /* * Test setFormatter with insufficient privilege. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies SecurityException.", - targets = { - @TestTarget( - methodName = "getFormatter", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies SecurityException.", + method = "getFormatter", + args = {} + ) public void testSetFormatter_InsufficientPrivilege() throws Exception { MockHandler h = new MockHandler(); SecurityManager oldMan = System.getSecurityManager(); @@ -588,17 +517,18 @@ public class HandlerTest extends TestCase { /* * Test getLevel & setLevel methods with non-null value. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify SecurityException.", - targets = { - @TestTarget( - methodName = "getLevel", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify SecurityException.", + method = "getLevel", + args = {} ), - @TestTarget( - methodName = "setLevel", - methodArgs = {java.util.logging.Level.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify SecurityException.", + method = "setLevel", + args = {java.util.logging.Level.class} ) }) public void testGetSetLevel_Normal() throws Exception { @@ -611,17 +541,18 @@ public class HandlerTest extends TestCase { /* * Test getLevel & setLevel methods with null. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getLevel & setLevel methods with null.", - targets = { - @TestTarget( - methodName = "getLevel", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getLevel & setLevel methods with null.", + method = "getLevel", + args = {} ), - @TestTarget( - methodName = "setLevel", - methodArgs = {java.util.logging.Level.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getLevel & setLevel methods with null.", + method = "setLevel", + args = {java.util.logging.Level.class} ) }) public void testGetSetLevel_Null() throws Exception { @@ -645,15 +576,12 @@ public class HandlerTest extends TestCase { /* * Test setLevel with insufficient privilege. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies NullPointerException, SecurityException.", - targets = { - @TestTarget( - methodName = "setLevel", - methodArgs = {java.util.logging.Level.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies NullPointerException, SecurityException.", + method = "setLevel", + args = {java.util.logging.Level.class} + ) public void testSetLevel_InsufficientPrivilege() throws Exception { MockHandler h = new MockHandler(); SecurityManager oldMan = System.getSecurityManager(); @@ -683,15 +611,12 @@ public class HandlerTest extends TestCase { /* * Use no filter */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "", - targets = { - @TestTarget( - methodName = "isLoggable", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "isLoggable", + args = {java.util.logging.LogRecord.class} + ) public void testIsLoggable_NoFilter() { MockHandler h = new MockHandler(); LogRecord r = new LogRecord(Level.CONFIG, null); @@ -711,15 +636,12 @@ public class HandlerTest extends TestCase { /* * Use a filter */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "Verifies isLoggable method with filter.", - targets = { - @TestTarget( - methodName = "isLoggable", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "Verifies isLoggable method with filter.", + method = "isLoggable", + args = {java.util.logging.LogRecord.class} + ) public void testIsLoggable_WithFilter() { MockHandler h = new MockHandler(); LogRecord r = new LogRecord(Level.CONFIG, null); @@ -747,15 +669,12 @@ public class HandlerTest extends TestCase { /** * @tests java.util.logging.Handler#isLoggable(LogRecord) */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies null as a parameter.", - targets = { - @TestTarget( - methodName = "isLoggable", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies null as a parameter.", + method = "isLoggable", + args = {java.util.logging.LogRecord.class} + ) public void testIsLoggable_Null() { MockHandler h = new MockHandler(); try { @@ -770,15 +689,12 @@ public class HandlerTest extends TestCase { * Test whether the error manager is actually called with expected * parameters. */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "reportError", - methodArgs = {java.lang.String.class, java.lang.Exception.class, int.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "reportError", + args = {java.lang.String.class, java.lang.Exception.class, int.class} + ) public void testReportError() { MockHandler h = new MockHandler(); h.setErrorManager(new MockErrorManager()); diff --git a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LevelTest.java b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LevelTest.java index bf6920f..1fee1ba 100644 --- a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LevelTest.java +++ b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LevelTest.java @@ -18,8 +18,8 @@ package org.apache.harmony.logging.tests.java.util.logging; import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargets; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestLevel; import java.io.Serializable; @@ -45,18 +45,18 @@ public class LevelTest extends TestCase implements Serializable { * Test the constructor without resource bundle parameter using normal * values. As byproducts, getName & intValue are also tested. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Checks the constructor without resource bundle parameter " + - "using normal values.", - targets = { - @TestTarget( - methodName = "Level", - methodArgs = {java.lang.String.class, int.class} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Checks the constructor without resource bundle parameter using normal values.", + method = "Level", + args = {java.lang.String.class, int.class} ), - @TestTarget( - methodName = "getName", - methodArgs = {} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Checks the constructor without resource bundle parameter using normal values.", + method = "getName", + args = {} ) }) public void testConstructorNoResBundle_Normal() { @@ -70,18 +70,18 @@ public class LevelTest extends TestCase implements Serializable { * Test the constructor without resource bundle parameter using null name. * As byproducts, getName & intValue are also tested. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Checks the constructor without resource bundle parameter " + - "using null name.", - targets = { - @TestTarget( - methodName = "Level", - methodArgs = {java.lang.String.class, int.class} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Checks the constructor without resource bundle parameter using null name.", + method = "Level", + args = {java.lang.String.class, int.class} ), - @TestTarget( - methodName = "getName", - methodArgs = {} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Checks the constructor without resource bundle parameter using null name.", + method = "getName", + args = {} ) }) public void testConstructorNoResBundle_NullName() { @@ -97,18 +97,18 @@ public class LevelTest extends TestCase implements Serializable { * Test the constructor without resource bundle parameter using empty name. * As byproducts, getName & intValue are also tested. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Checks the constructor without resource bundle parameter " + - "using empty name.", - targets = { - @TestTarget( - methodName = "Level", - methodArgs = {java.lang.String.class, int.class} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Checks the constructor without resource bundle parameter using empty name.", + method = "Level", + args = {java.lang.String.class, int.class} ), - @TestTarget( - methodName = "getName", - methodArgs = {} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Checks the constructor without resource bundle parameter using empty name.", + method = "getName", + args = {} ) }) public void testConstructorNoResBundle_EmptyName() { @@ -122,17 +122,18 @@ public class LevelTest extends TestCase implements Serializable { * Test the constructor having resource bundle parameter using normal * values. As byproducts, getName & intValue are also tested. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "", - targets = { - @TestTarget( - methodName = "Level", - methodArgs = {String.class, int.class, String.class} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "Level", + args = {java.lang.String.class, int.class, java.lang.String.class} ), - @TestTarget( - methodName = "getName", - methodArgs = {} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getName", + args = {} ) }) public void testConstructorHavingResBundle_Normal() { @@ -146,16 +147,12 @@ public class LevelTest extends TestCase implements Serializable { * Test the constructor having resource bundle parameter using null names. * As byproducts, getName & intValue are also tested. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Checks NullPointerException.", - targets = { - @TestTarget( - methodName = "Level", - methodArgs = {java.lang.String.class, int.class, - java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Checks NullPointerException.", + method = "Level", + args = {java.lang.String.class, int.class, java.lang.String.class} + ) public void testConstructorHavingResBundle_NullName() { try { new MockLevel(null, -123, "qwe"); @@ -170,16 +167,12 @@ public class LevelTest extends TestCase implements Serializable { names. * As byproducts, getName & intValue are also tested. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies the constructor having resource bundle parameter " + - "using empty names.", - targets = { - @TestTarget( - methodName = "Level", - methodArgs = {String.class, int.class, String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies the constructor having resource bundle parameter using empty names.", + method = "Level", + args = {java.lang.String.class, int.class, java.lang.String.class} + ) public void testConstructorHavingResBundle_EmptyName() { MockLevel l = new MockLevel("", -1000, ""); assertEquals("", l.getName()); @@ -190,15 +183,12 @@ public class LevelTest extends TestCase implements Serializable { /* * Test method parse, with the pre-defined string consts. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies parse, with the pre-defined string consts.", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies parse, with the pre-defined string consts.", + method = "parse", + args = {java.lang.String.class} + ) public void testParse_PredefinedConstStrings() { assertSame(Level.SEVERE, Level.parse("SEVERE")); assertSame(Level.WARNING, Level.parse("WARNING")); @@ -214,15 +204,12 @@ public class LevelTest extends TestCase implements Serializable { /* * Test method parse, with an undefined string. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "IllegalArgumentException is verified.", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "IllegalArgumentException is verified.", + method = "parse", + args = {java.lang.String.class} + ) public void testParse_IllegalConstString() { try { Level.parse("SEVERe"); @@ -235,15 +222,12 @@ public class LevelTest extends TestCase implements Serializable { /* * Test method parse, with a null string. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies null as a parameter.", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies null as a parameter.", + method = "parse", + args = {java.lang.String.class} + ) public void testParse_NullString() { try { Level.parse(null); @@ -256,15 +240,12 @@ public class LevelTest extends TestCase implements Serializable { /* * Test method parse, with pre-defined valid number strings. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies parse, with pre-defined valid number strings.", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies parse, with pre-defined valid number strings.", + method = "parse", + args = {java.lang.String.class} + ) public void testParse_PredefinedNumber() { assertSame(Level.SEVERE, Level.parse("SEVERE")); assertSame(Level.WARNING, Level.parse("WARNING")); @@ -289,15 +270,12 @@ public class LevelTest extends TestCase implements Serializable { /* * Test method parse, with an undefined valid number strings. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies parse, with an undefined valid number strings.", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies parse, with an undefined valid number strings.", + method = "parse", + args = {java.lang.String.class} + ) public void testParse_UndefinedNumber() { Level l = Level.parse("0"); assertEquals(0, l.intValue()); @@ -308,16 +286,12 @@ public class LevelTest extends TestCase implements Serializable { /* * Test method parse, with an undefined valid number strings with spaces. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies parse, with an undefined valid number strings " + - "with spaces.", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies parse, with an undefined valid number strings with spaces.", + method = "parse", + args = {java.lang.String.class} + ) public void testParse_UndefinedNumberWithSpaces() { try { Level.parse(" 0"); @@ -325,15 +299,12 @@ public class LevelTest extends TestCase implements Serializable { // expected } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies negative number.", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies negative number.", + method = "parse", + args = {java.lang.String.class} + ) public void testParse_NegativeNumber() { Level l = Level.parse("-4"); assertEquals(-4, l.intValue()); @@ -345,16 +316,12 @@ public class LevelTest extends TestCase implements Serializable { * Test method parse, expecting the same objects will be returned given the * same name, even for non-predefined levels. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies parse, expecting the same objects will be returned " + - "given the same name, even for non-predefined levels.", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies parse, expecting the same objects will be returned given the same name, even for non-predefined levels.", + method = "parse", + args = {java.lang.String.class} + ) public void testParse_SameObject() { Level l = Level.parse("-100"); assertSame(l, Level.parse("-100")); @@ -363,15 +330,12 @@ public class LevelTest extends TestCase implements Serializable { /* * Test method hashCode, with normal fields. */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "hashCode", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "hashCode", + args = {} + ) public void testHashCode_Normal() { assertEquals(100, Level.parse("100").hashCode()); assertEquals(-1, Level.parse("-1").hashCode()); @@ -382,15 +346,12 @@ public class LevelTest extends TestCase implements Serializable { /* * Test equals when two objects are equal. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't check negative case.", - targets = { - @TestTarget( - methodName = "equals", - methodArgs = {java.lang.Object.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't check negative case.", + method = "equals", + args = {java.lang.Object.class} + ) public void testEquals_Equal() { MockLevel l1 = new MockLevel("level1", 1); MockLevel l2 = new MockLevel("level2", 1); @@ -401,15 +362,12 @@ public class LevelTest extends TestCase implements Serializable { /* * Test equals when two objects are not equal. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Checks negative case.", - targets = { - @TestTarget( - methodName = "equals", - methodArgs = {java.lang.Object.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Checks negative case.", + method = "equals", + args = {java.lang.Object.class} + ) public void testEquals_NotEqual() { MockLevel l1 = new MockLevel("level1", 1); MockLevel l2 = new MockLevel("level1", 2); @@ -420,15 +378,12 @@ public class LevelTest extends TestCase implements Serializable { /* * Test equals when the other object is null. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Checks null as a parameter.", - targets = { - @TestTarget( - methodName = "equals", - methodArgs = {java.lang.Object.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Checks null as a parameter.", + method = "equals", + args = {java.lang.Object.class} + ) public void testEquals_Null() { assertFalse(Level.ALL.equals(null)); } @@ -436,15 +391,12 @@ public class LevelTest extends TestCase implements Serializable { /* * Test equals when the other object is not an instance of Level. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Checks negative case.", - targets = { - @TestTarget( - methodName = "equals", - methodArgs = {java.lang.Object.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Checks negative case.", + method = "equals", + args = {java.lang.Object.class} + ) public void testEquals_NotLevel() { assertFalse(Level.ALL.equals(new Object())); } @@ -452,15 +404,12 @@ public class LevelTest extends TestCase implements Serializable { /* * Test equals when the other object is itself. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Checks equals when the other object is itself.", - targets = { - @TestTarget( - methodName = "equals", - methodArgs = {java.lang.Object.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Checks equals when the other object is itself.", + method = "equals", + args = {java.lang.Object.class} + ) public void testEquals_Itself() { assertTrue(Level.ALL.equals(Level.ALL)); } @@ -468,15 +417,12 @@ public class LevelTest extends TestCase implements Serializable { /* * Test toString of a normal Level. */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "toString", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "toString", + args = {} + ) public void testToString_Normal() { assertEquals("ALL", Level.ALL.toString()); @@ -511,15 +457,12 @@ public class LevelTest extends TestCase implements Serializable { * Test serialization of pre-defined const levels. It is expected that the * deserialized cost level should be the same instance as the existing one. */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "Serialization of pre-defined const levels. ", - targets = { - @TestTarget( - methodName = "!SerializationSelf", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "Serialization of pre-defined const levels. ", + method = "!SerializationSelf", + args = {} + ) public void testSerialization_ConstLevel() throws Exception { SerializationTest.verifySelf(Level.ALL, @@ -532,15 +475,12 @@ public class LevelTest extends TestCase implements Serializable { * Test serialization of normal instance of Level. It is expected that the * deserialized level object should be equal to the original one. */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "Test serialization of normal instance of Level.", - targets = { - @TestTarget( - methodName = "!SerializationSelf", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "Test serialization of normal instance of Level.", + method = "!SerializationSelf", + args = {} + ) public void testSerialization_InstanceLevel() throws Exception { // tests that objects are the same @@ -560,29 +500,23 @@ public class LevelTest extends TestCase implements Serializable { /** * @tests serialization/deserialization compatibility with RI. */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "Serialization/deserialization compatibility", - targets = { - @TestTarget( - methodName = "!SerializationGolden", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "Serialization/deserialization compatibility", + method = "!SerializationGolden", + args = {} + ) public void testSerializationCompatibility() throws Exception { SerializationTest.verifyGolden(this, new MockLevel("123", 123, "bundle"), LEVEL_COMPARATOR); } - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "getLocalizedName", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getLocalizedName", + args = {} + ) public void testGetLocalName() { ResourceBundle rb = ResourceBundle.getBundle("bundles/java/util/logging/res"); Level l = new MockLevel("level1", 120, @@ -609,15 +543,12 @@ public class LevelTest extends TestCase implements Serializable { /* * test for method public String getResourceBundleName() */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "getResourceBundleName", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getResourceBundleName", + args = {} + ) public void testGetResourceBundleName() { String bundleName = "bundles/java/util/logging/res"; Level l = new MockLevel("level1", 120); @@ -634,15 +565,12 @@ public class LevelTest extends TestCase implements Serializable { /* * test for method public final int intValue() */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "intValue", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "intValue", + args = {} + ) public void testIntValue() { int value1 = 120; Level l = new MockLevel("level1", value1); @@ -654,15 +582,12 @@ public class LevelTest extends TestCase implements Serializable { /* * Test defining new levels in subclasses of Level */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "Test defining new levels in subclasses of Level", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {String.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "Test defining new levels in subclasses of Level", + method = "parse", + args = {java.lang.String.class} + ) public void testSubclassNewLevel() { MyLevel.DUPLICATENAME.getName();// just to load MyLevel class diff --git a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LogManagerTest.java b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LogManagerTest.java index 8e6256e..8be31e9 100644 --- a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LogManagerTest.java +++ b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LogManagerTest.java @@ -105,36 +105,36 @@ public class LogManagerTest extends TestCase { handler = null; } - @TestInfo( - level = TestLevel.TODO, - purpose = "not really necessary, already tested with the singleton " + - "getLogManager.", - targets = { - - @TestTarget( - methodName = "LogManager", - methodArgs = {Logger.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "LogManager", + args = {} + ) public void testLogManager() { - + class TestLogManager extends LogManager { + public TestLogManager() { + super(); + } + } + TestLogManager tlm = new TestLogManager(); + assertNotNull(tlm.toString()); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies NullPointerException.", - targets = { - - @TestTarget( - methodName = "addLogger", - methodArgs = {Logger.class} - ), - - @TestTarget( - methodName = "getLogger", - methodArgs = {String.class} - ) - }) + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies NullPointerException.", + method = "addLogger", + args = {java.util.logging.Logger.class} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies NullPointerException.", + method = "getLogger", + args = {java.lang.String.class} + ) + }) public void testAddGetLogger() { Logger log = new MockLogger(FOO, null); Logger foo = mockManager.getLogger(FOO); @@ -168,21 +168,20 @@ public class LogManagerTest extends TestCase { assertEquals(i, 1); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "", - targets = { - - @TestTarget( - methodName = "addLogger", - methodArgs = {Logger.class} - ), - - @TestTarget( - methodName = "getLogger", - methodArgs = {String.class} - ) - }) + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "addLogger", + args = {java.util.logging.Logger.class} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getLogger", + args = {java.lang.String.class} + ) + }) public void testAddGetLogger_duplicateName() { // add logger with duplicate name has no effect Logger foo = new MockLogger(FOO, null); @@ -200,21 +199,20 @@ public class LogManagerTest extends TestCase { assertEquals(1, i); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "", - targets = { - - @TestTarget( - methodName = "addLogger", - methodArgs = {Logger.class} - ), - - @TestTarget( - methodName = "getLogger", - methodArgs = {String.class} - ) - }) + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "addLogger", + args = {java.util.logging.Logger.class} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getLogger", + args = {java.lang.String.class} + ) + }) public void testAddGetLogger_Hierachy() { Logger foo = new MockLogger("testAddGetLogger_Hierachy.foo", null); Logger child = new MockLogger("testAddGetLogger_Hierachy.foo.child", null); @@ -254,21 +252,20 @@ public class LogManagerTest extends TestCase { assertSame(otherChild, grandson.getParent()); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "", - targets = { - - @TestTarget( - methodName = "addLogger", - methodArgs = {Logger.class} - ), - - @TestTarget( - methodName = "getLogger", - methodArgs = {String.class} - ) - }) + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "addLogger", + args = {java.util.logging.Logger.class} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getLogger", + args = {java.lang.String.class} + ) + }) public void testAddLoggerReverseOrder() { Logger root = new MockLogger("testAddLoggerReverseOrder", null); Logger foo = new MockLogger("testAddLoggerReverseOrder.foo", null); @@ -301,17 +298,12 @@ public class LogManagerTest extends TestCase { assertSame(realRoot, root.getParent()); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "", - targets = { - - @TestTarget( - methodName = "addLogger", - methodArgs = {Logger.class} - ) - - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "addLogger", + args = {java.util.logging.Logger.class} + ) public void testAddSimiliarLogger() { Logger root = new MockLogger("testAddSimiliarLogger", null); Logger foo = new MockLogger("testAddSimiliarLogger.foo", null); @@ -343,21 +335,20 @@ public class LogManagerTest extends TestCase { assertSame(fooo, foooChild.getParent()); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "", - targets = { - - @TestTarget( - methodName = "addLogger", - methodArgs = {Logger.class} - ), - @TestTarget( - methodName = "getLogger", - methodArgs = {String.class} - ) - - }) + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "addLogger", + args = {java.util.logging.Logger.class} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getLogger", + args = {java.lang.String.class} + ) + }) public void testAddGetLogger_nameWithSpace() { Logger foo = new MockLogger(FOO, null); Logger fooBeforeSpace = new MockLogger(FOO + " ", null); @@ -374,22 +365,20 @@ public class LogManagerTest extends TestCase { assertSame(fooWithBothSpace, mockManager.getLogger(" " + FOO + " ")); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify NullPointerException of addLogger " + - "method.", - targets = { - - @TestTarget( - methodName = "addLogger", - methodArgs = {Logger.class} - ), - @TestTarget( - methodName = "getLogger", - methodArgs = {String.class} - ) - - }) + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify NullPointerException", + method = "addLogger", + args = {java.util.logging.Logger.class} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getLogger", + args = {java.lang.String.class} + ) + }) public void testAddGetLogger_addRoot() throws IOException { Logger foo = new MockLogger(FOO, null); Logger fooChild = new MockLogger(FOO + ".child", null); @@ -420,21 +409,20 @@ public class LogManagerTest extends TestCase { /** * @tests java.util.logging.LogManager#addLogger(Logger) */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - - @TestTarget( - methodName = "addLogger", - methodArgs = {Logger.class} - ), - @TestTarget( - methodName = "getLogManager", - methodArgs = {} - ) - - }) + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "addLogger", + args = {java.util.logging.Logger.class} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getLogManager", + args = {} + ) + }) public void test_addLoggerLLogger_Security() throws Exception { // regression test for Harmony-1286 SecurityManager originalSecurityManager = System.getSecurityManager(); @@ -448,16 +436,13 @@ public class LogManagerTest extends TestCase { } } - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "readConfiguration", - methodArgs = {InputStream.class} - ) - }) - public void _testDefaultLoggerProperties() throws Exception { + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "readConfiguration", + args = {java.io.InputStream.class} + ) + public void testDefaultLoggerProperties() throws Exception { // mock LogManager has no default logger assertNull(mockManager.getLogger("")); assertNull(mockManager.getLogger("global")); @@ -491,21 +476,20 @@ public class LogManagerTest extends TestCase { * case 4: check correct tested value */ - @TestInfo( + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getLogger", + args = {java.lang.String.class} + ), + @TestTargetNew( level = TestLevel.COMPLETE, - purpose = "", - targets = { - - @TestTarget( - methodName = "getLogger", - methodArgs = {String.class} - ), - @TestTarget( - methodName = "getLoggerNames", - methodArgs = {} - ) - - }) + notes = "", + method = "getLoggerNames", + args = {} + ) + }) public void testGetLogger() throws Exception { // case 1: test default and valid value @@ -542,20 +526,20 @@ public class LogManagerTest extends TestCase { /* * test for method public Logger getLogger(String name) */ - @TestInfo( + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getLogger", + args = {java.lang.String.class} + ), + @TestTargetNew( level = TestLevel.PARTIAL, - purpose = "", - targets = { - - @TestTarget( - methodName = "getLogger", - methodArgs = {String.class} - ), - @TestTarget( - methodName = "getLoggerNames", - methodArgs = {} - ) - }) + notes = "", + method = "getLoggerNames", + args = {} + ) + }) public void testGetLogger_duplicateName() throws Exception { // test duplicate name // add logger with duplicate name has no effect @@ -579,17 +563,12 @@ public class LogManagerTest extends TestCase { /* * test for method public Logger getLogger(String name) */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "", - targets = { - - @TestTarget( - methodName = "getLogger", - methodArgs = {String.class} - ) - - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getLogger", + args = {java.lang.String.class} + ) public void testGetLogger_hierachy() throws Exception { // test hierachy Logger foo = new MockLogger("testGetLogger_hierachy.foo", null); @@ -602,17 +581,12 @@ public class LogManagerTest extends TestCase { /* * test for method public Logger getLogger(String name) */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "", - targets = { - - @TestTarget( - methodName = "getLogger", - methodArgs = {String.class} - ) - - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getLogger", + args = {java.lang.String.class} + ) public void testGetLogger_nameSpace() throws Exception { // test name with space Logger foo = new MockLogger(FOO, null); @@ -633,22 +607,20 @@ public class LogManagerTest extends TestCase { /* * test for method public void checkAccess() throws SecurityException */ - @TestInfo( + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "checkAccess", + args = {} + ), + @TestTargetNew( level = TestLevel.COMPLETE, - purpose = "", - targets = { - - @TestTarget( - methodName = "checkAccess", - methodArgs = {} - ), - - @TestTarget( - methodName = "getLogManager", - methodArgs = {} - ) - - }) + notes = "", + method = "getLogManager", + args = {} + ) + }) public void testCheckAccess() { try { manager.checkAccess(); @@ -670,33 +642,38 @@ public class LogManagerTest extends TestCase { System.setSecurityManager(securityManager); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies SecurityException.", - targets = { - @TestTarget( - methodName = "readConfiguration", - methodArgs = {InputStream.class} - ), - @TestTarget( - methodName = "readConfiguration", - methodArgs = {} - ), - @TestTarget( - methodName = "checkAccess", - methodArgs = {} - ), - @TestTarget( - methodName = "reset", - methodArgs = {} - ), - - @TestTarget( - methodName = "getLogManager", - methodArgs = {} - ) - - }) + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies SecurityException.", + method = "readConfiguration", + args = {java.io.InputStream.class} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies SecurityException.", + method = "readConfiguration", + args = {} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies SecurityException.", + method = "checkAccess", + args = {} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies SecurityException.", + method = "reset", + args = {} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies SecurityException.", + method = "getLogManager", + args = {} + ) + }) public void testLoggingPermission() throws IOException { System.setSecurityManager(new MockSecurityManagerLogPermission()); mockManager.addLogger(new MockLogger("abc", null)); @@ -749,19 +726,20 @@ public class LogManagerTest extends TestCase { } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "", - targets = { - @TestTarget( - methodName = "readConfiguration", - methodArgs = {InputStream.class} - ), - @TestTarget( - methodName = "getProperty", - methodArgs = {String.class} - ) - }) + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "readConfiguration", + args = {java.io.InputStream.class} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getProperty", + args = {java.lang.String.class} + ) + }) public void testMockGetProperty() throws Exception { // mock manager doesn't read configuration until you call // readConfiguration() @@ -780,17 +758,12 @@ public class LogManagerTest extends TestCase { assertEquals(0, mockManager.getLogger("").getHandlers().length); } - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - - @TestTarget( - methodName = "getProperty", - methodArgs = {String.class} - ) - - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getProperty", + args = {java.lang.String.class} + ) public void testGetProperty() throws SecurityException, IOException { Logger root = manager.getLogger(""); @@ -806,17 +779,12 @@ public class LogManagerTest extends TestCase { manager.readConfiguration(EnvironmentHelper.PropertiesToInputStream(props)); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies NullPointerException.", - targets = { - - @TestTarget( - methodName = "readConfiguration", - methodArgs = {InputStream.class} - ) - - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies NullPointerException.", + method = "readConfiguration", + args = {java.io.InputStream.class} + ) public void testReadConfiguration_null() throws SecurityException, IOException { try { manager.readConfiguration(null); @@ -826,19 +794,6 @@ public class LogManagerTest extends TestCase { } - - - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - - @TestTarget( - methodName = "getProperty", - methodArgs = {String.class} - ) - - }) private static void checkPropertyNull(LogManager m) { // assertNull(m.getProperty(".level")); assertNull(m.getProperty("java.util.logging.FileHandler.limit")); @@ -851,17 +806,6 @@ public class LogManagerTest extends TestCase { assertNull(m.getProperty("java.util.logging.FileHandler.pattern")); } - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - - @TestTarget( - methodName = "getProperty", - methodArgs = {String.class} - ) - - }) private static void checkProperty(LogManager m) { // assertEquals(m.getProperty(".level"), "INFO"); assertEquals(m.getProperty("java.util.logging.FileHandler.limit"), "50000"); @@ -907,17 +851,12 @@ public class LogManagerTest extends TestCase { /* * Class under test for void readConfiguration(InputStream) */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "", - targets = { - - @TestTarget( - methodName = "readConfiguration", - methodArgs = {InputStream.class} - ) - - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "readConfiguration", + args = {java.io.InputStream.class} + ) public void testReadConfigurationInputStream() throws IOException { // mock LogManager InputStream stream = EnvironmentHelper.PropertiesToInputStream(props); @@ -949,17 +888,12 @@ public class LogManagerTest extends TestCase { assertSame(l, h.getLevel()); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies NullPointerException.", - targets = { - - @TestTarget( - methodName = "readConfiguration", - methodArgs = {InputStream.class} - ) - - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies NullPointerException.", + method = "readConfiguration", + args = {java.io.InputStream.class} + ) public void testReadConfigurationInputStream_null() throws SecurityException, IOException { try { mockManager.readConfiguration(null); @@ -968,17 +902,12 @@ public class LogManagerTest extends TestCase { } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies IOException.", - targets = { - - @TestTarget( - methodName = "readConfiguration", - methodArgs = {InputStream.class} - ) - - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies IOException.", + method = "readConfiguration", + args = {java.io.InputStream.class} + ) public void testReadConfigurationInputStream_IOException_1parm() throws SecurityException { try { mockManager.readConfiguration(new MockInputStream()); @@ -989,17 +918,12 @@ public class LogManagerTest extends TestCase { } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "", - targets = { - - @TestTarget( - methodName = "readConfiguration", - methodArgs = {InputStream.class} - ) - - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "readConfiguration", + args = {java.io.InputStream.class} + ) public void testReadConfigurationInputStream_root() throws IOException { InputStream stream = EnvironmentHelper.PropertiesToInputStream(props); manager.readConfiguration(EnvironmentHelper.PropertiesToInputStream(props)); @@ -1086,17 +1010,12 @@ public class LogManagerTest extends TestCase { // mockManager.removePropertyChangeListener(null); // } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify SecurityException.", - targets = { - - @TestTarget( - methodName = "reset", - methodArgs = {} - ) - - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify SecurityException.", + method = "reset", + args = {} + ) public void testReset() throws SecurityException, IOException { // mock LogManager mockManager.readConfiguration(EnvironmentHelper.PropertiesToInputStream(props)); @@ -1132,17 +1051,12 @@ public class LogManagerTest extends TestCase { } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify SecurityException.", - targets = { - - @TestTarget( - methodName = "readConfiguration", - methodArgs = {InputStream.class} - ) - - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify SecurityException.", + method = "readConfiguration", + args = {java.io.InputStream.class} + ) public void testGlobalPropertyConfig() throws Exception { PrintStream err = System.err; try { @@ -1215,17 +1129,12 @@ public class LogManagerTest extends TestCase { } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "", - targets = { - - @TestTarget( - methodName = "readConfiguration", - methodArgs = {} - ) - - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "readConfiguration", + args = {} + ) public void testValidConfigClass() throws Exception { String oldProperty = System.getProperty("java.util.logging.config.class"); try { diff --git a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LogRecordTest.java b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LogRecordTest.java index 166483e..5b21099 100644 --- a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LogRecordTest.java +++ b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LogRecordTest.java @@ -17,9 +17,9 @@ package org.apache.harmony.logging.tests.java.util.logging; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import java.io.Serializable; @@ -50,11 +50,12 @@ public class LogRecordTest extends TestCase { lr = new LogRecord(Level.CONFIG, MSG); } - @TestInfo(level = TestLevel.COMPLETE, purpose = "", - targets = { - @TestTarget(methodName = "LogRecord", methodArgs = { - Level.class, String.class}) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "LogRecord", + args = {java.util.logging.Level.class, java.lang.String.class} + ) public void testLogRecordWithNullPointers() { try { new LogRecord(null, null); @@ -71,9 +72,19 @@ public class LogRecordTest extends TestCase { assertNull(r.getMessage()); } - @TestInfo(level = TestLevel.COMPLETE, purpose = "normally set/get don't need to be tested", targets = { - @TestTarget(methodName = "getLoggerName", methodArgs = {}), - @TestTarget(methodName = "setLoggerName", methodArgs = {String.class}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "normally set/get don't need to be tested", + method = "getLoggerName", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "normally set/get don't need to be tested", + method = "setLoggerName", + args = {java.lang.String.class} + ) }) public void testGetSetLoggerName() { assertNull(lr.getLoggerName()); @@ -84,9 +95,19 @@ public class LogRecordTest extends TestCase { } - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "getResourceBundle", methodArgs = {}), - @TestTarget(methodName = "setResourceBundle", methodArgs = {ResourceBundle.class}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getResourceBundle", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setResourceBundle", + args = {java.util.ResourceBundle.class} + ) }) public void testGetSetResourceBundle() { assertNull(lr.getResourceBundleName()); @@ -106,9 +127,19 @@ public class LogRecordTest extends TestCase { assertNull(lr.getResourceBundleName()); } - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "getResourceBundleName", methodArgs = {}), - @TestTarget(methodName = "setResourceBundleName", methodArgs = {String.class}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getResourceBundleName", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setResourceBundleName", + args = {java.lang.String.class} + ) }) public void testGetSetResourceBundleName() { assertNull(lr.getResourceBundleName()); @@ -118,9 +149,19 @@ public class LogRecordTest extends TestCase { assertEquals("test", lr.getResourceBundleName()); } - @TestInfo(level = TestLevel.COMPLETE, purpose = "normal behavior of getter/setter don't need to be tested (normally)", targets = { - @TestTarget(methodName = "getLevel", methodArgs = {}), - @TestTarget(methodName = "setLevel", methodArgs = {Level.class}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "normal behavior of getter/setter don't need to be tested (normally)", + method = "getLevel", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "normal behavior of getter/setter don't need to be tested (normally)", + method = "setLevel", + args = {java.util.logging.Level.class} + ) }) public void testGetSetLevelNormal() { assertSame(lr.getLevel(), Level.CONFIG); @@ -130,9 +171,19 @@ public class LogRecordTest extends TestCase { assertSame(lr.getLevel(), Level.FINEST); } - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "getLevel", methodArgs = {}), - @TestTarget(methodName = "setLevel", methodArgs = {Level.class}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getLevel", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setLevel", + args = {java.util.logging.Level.class} + ) }) public void testGetSetLevelNullPointerException() { try { @@ -143,9 +194,19 @@ public class LogRecordTest extends TestCase { assertSame(lr.getLevel(), Level.CONFIG); } - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "getSequenceNumber", methodArgs = {}), - @TestTarget(methodName = "setSequenceNumber", methodArgs = {long.class}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getSequenceNumber", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setSequenceNumber", + args = {long.class} + ) }) public void testGetSetSequenceNumber() { long l = lr.getSequenceNumber(); @@ -157,9 +218,19 @@ public class LogRecordTest extends TestCase { assertEquals(lr.getSequenceNumber(), l + 1); } - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "getSourceClassName", methodArgs = {}), - @TestTarget(methodName = "setSourceClassName", methodArgs = {String.class}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getSourceClassName", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setSourceClassName", + args = {java.lang.String.class} + ) }) public void testGetSetSourceClassName() { lr.setSourceClassName(null); @@ -170,9 +241,19 @@ public class LogRecordTest extends TestCase { assertEquals(this.getClass().getName(), lr.getSourceClassName()); } - @TestInfo(level = TestLevel.PARTIAL_OK, purpose = "", targets = { - @TestTarget(methodName = "getSourceMethodName", methodArgs = {}), - @TestTarget(methodName = "setSourceMethodName", methodArgs = {String.class}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getSourceMethodName", + args = {} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "setSourceMethodName", + args = {java.lang.String.class} + ) }) public void testGetSetSourceMethodName() { lr.setSourceMethodName(null); @@ -183,11 +264,31 @@ public class LogRecordTest extends TestCase { assertEquals(this.getClass().getName(), lr.getSourceMethodName()); } - @TestInfo(level = TestLevel.PARTIAL_OK, purpose = "", targets = { - @TestTarget(methodName = "getSourceMethodName", methodArgs = {}), - @TestTarget(methodName = "setSourceMethodName", methodArgs = {String.class}), - @TestTarget(methodName = "getSourceClassName", methodArgs = {}), - @TestTarget(methodName = "setSourceClassName", methodArgs = {String.class}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getSourceMethodName", + args = {} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "setSourceMethodName", + args = {java.lang.String.class} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getSourceClassName", + args = {} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "setSourceClassName", + args = {java.lang.String.class} + ) }) public void testGetSourceDefaultValue() { assertNull(lr.getSourceMethodName()); @@ -262,9 +363,19 @@ public class LogRecordTest extends TestCase { logger.removeHandler(handler); } - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "getMessage", methodArgs = {}), - @TestTarget(methodName = "setMessage", methodArgs = {String.class}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getMessage", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setMessage", + args = {java.lang.String.class} + ) }) public void testGetSetMessage() { assertEquals(MSG, lr.getMessage()); @@ -274,9 +385,19 @@ public class LogRecordTest extends TestCase { assertEquals("", lr.getMessage()); } - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "getParameters", methodArgs = {}), - @TestTarget(methodName = "setParameters", methodArgs = {Object[].class}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getParameters", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setParameters", + args = {java.lang.Object[].class} + ) }) public void testGetSetParameters() { assertNull(lr.getParameters()); @@ -290,9 +411,19 @@ public class LogRecordTest extends TestCase { assertSame(oa, lr.getParameters()); } - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "getMillis", methodArgs = {}), - @TestTarget(methodName = "setMillis", methodArgs = {long.class}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getMillis", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setMillis", + args = {long.class} + ) }) public void testGetSetMillis() { long milli = lr.getMillis(); @@ -303,9 +434,19 @@ public class LogRecordTest extends TestCase { assertEquals(0, lr.getMillis()); } - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "getMillis", methodArgs = {}), - @TestTarget(methodName = "setMillis", methodArgs = {long.class}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getMillis", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setMillis", + args = {long.class} + ) }) public void testGetSetTimeCheck() { long before = lr.getMillis(); @@ -321,9 +462,19 @@ public class LogRecordTest extends TestCase { - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "getThreadID", methodArgs = {}), - @TestTarget(methodName = "setThreadID", methodArgs = {int.class}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getThreadID", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setThreadID", + args = {int.class} + ) }) public void testGetSetThreadID() { int id = lr.getThreadID(); @@ -338,9 +489,19 @@ public class LogRecordTest extends TestCase { /* * Check threadID are different */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "getThreadID", methodArgs = {}), - @TestTarget(methodName = "setThreadID", methodArgs = {int.class}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getThreadID", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setThreadID", + args = {int.class} + ) }) public void testGetSetThreadID_DifferentThread() { int id = lr.getThreadID(); @@ -368,9 +529,20 @@ public class LogRecordTest extends TestCase { } - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "getThrown", methodArgs = {}), - @TestTarget(methodName = "setThrown", methodArgs = {Throwable.class})}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getThrown", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setThrown", + args = {java.lang.Throwable.class} + ) + }) public void testGetSetThrown() { assertNull(lr.getThrown()); lr.setThrown(null); @@ -428,8 +600,12 @@ public class LogRecordTest extends TestCase { /** * @tests serialization/deserialization compatibility. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "serialisation/deserialization", targets = { - @TestTarget(methodName = "!SerializationSelf", methodArgs = {})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "serialisation/deserialization", + method = "!SerializationSelf", + args = {} + ) public void testSerializationSelf() throws Exception { LogRecord r = new LogRecord(Level.ALL, "msg"); r.setLoggerName("LoggerName"); @@ -448,11 +624,12 @@ public class LogRecordTest extends TestCase { /** * @tests resolution of resource bundle for serialization/deserialization. */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "tests resolution of resource bundle during deserialization", - targets = { - @TestTarget(methodName = "!Serialization", methodArgs = {})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "tests resolution of resource bundle during deserialization", + method = "!Serialization", + args = {} + ) public void testSerializationResourceBundle() throws Exception { // test case: valid resource bundle name @@ -476,8 +653,12 @@ public class LogRecordTest extends TestCase { /** * @tests serialization/deserialization compatibility with RI. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "!SerializationGolden", methodArgs = {})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "!SerializationGolden", + args = {} + ) public void testSerializationCompatibility() throws Exception { LogRecord r = new LogRecord(Level.ALL, "msg"); r.setLoggerName("LoggerName"); diff --git a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggerTest.java b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggerTest.java index 19c6eb3..046a7a8 100644 --- a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggerTest.java +++ b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggerTest.java @@ -17,9 +17,11 @@ package org.apache.harmony.logging.tests.java.util.logging; -import dalvik.annotation.TestInfo; +import dalvik.annotation.AndroidOnly; +import dalvik.annotation.KnownFailure; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import junit.framework.TestCase; @@ -101,9 +103,12 @@ public class LoggerTest extends TestCase { /* * Test the global logger */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "Logger", methodArgs = {String.class, String.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "Logger", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGlobalLogger() { assertNull(Logger.global.getFilter()); assertEquals(0, Logger.global.getHandlers().length); @@ -121,15 +126,12 @@ public class LoggerTest extends TestCase { /* * Test constructor under normal conditions. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies constructor under normal conditions.", - targets = { - @TestTarget( - methodName = "Logger", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies constructor under normal conditions.", + method = "Logger", + args = {java.lang.String.class, java.lang.String.class} + ) public void testConstructor_Normal() { MockLogger mlog = new MockLogger("myname", VALID_RESOURCE_BUNDLE); assertNull(mlog.getFilter()); @@ -146,15 +148,12 @@ public class LoggerTest extends TestCase { /* * Test constructor with null parameters. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies constructor with null parameters.", - targets = { - @TestTarget( - methodName = "Logger", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies constructor with null parameters.", + method = "Logger", + args = {java.lang.String.class, java.lang.String.class} + ) public void testConstructor_Null() { MockLogger mlog = new MockLogger(null, null); assertNull(mlog.getFilter()); @@ -170,15 +169,12 @@ public class LoggerTest extends TestCase { /* * Test constructor with invalid name. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies constructor with invalid name.", - targets = { - @TestTarget( - methodName = "Logger", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies constructor with invalid name.", + method = "Logger", + args = {java.lang.String.class, java.lang.String.class} + ) public void testConstructor_InvalidName() { MockLogger mlog = new MockLogger("...#$%%^&&()-_+=!@~./,[]{};:'\\\"?|", null); @@ -188,15 +184,12 @@ public class LoggerTest extends TestCase { /* * Test constructor with empty name. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies constructor with empty name.", - targets = { - @TestTarget( - methodName = "Logger", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies constructor with empty name.", + method = "Logger", + args = {java.lang.String.class, java.lang.String.class} + ) public void testConstructor_EmptyName() { MockLogger mlog = new MockLogger("", null); assertEquals("", mlog.getName()); @@ -205,15 +198,12 @@ public class LoggerTest extends TestCase { /* * Test constructor with invalid resource bundle name. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies MissingResourceException.", - targets = { - @TestTarget( - methodName = "Logger", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies MissingResourceException.", + method = "Logger", + args = {java.lang.String.class, java.lang.String.class} + ) public void testConstructor_InvalidResourceBundle() { // try anonymous with invalid resource @@ -243,15 +233,12 @@ public class LoggerTest extends TestCase { /* * Test getAnonymousLogger() */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "getAnonymousLogger", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getAnonymousLogger", + args = {} + ) public void testGetAnonymousLogger() { Logger alog = Logger.getAnonymousLogger(); assertNotSame(alog, Logger.getAnonymousLogger()); @@ -270,16 +257,12 @@ public class LoggerTest extends TestCase { * Test getAnonymousLogger(String resourceBundleName) with valid resource * bundle. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getAnonymousLogger(String resourceBundleName) " + - "with valid resource bundle.", - targets = { - @TestTarget( - methodName = "getAnonymousLogger", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getAnonymousLogger(String resourceBundleName) with valid resource bundle.", + method = "getAnonymousLogger", + args = {java.lang.String.class} + ) public void testGetAnonymousLogger_ValidResourceBundle() { Logger alog = Logger.getAnonymousLogger(VALID_RESOURCE_BUNDLE); assertNotSame(alog, Logger.getAnonymousLogger(VALID_RESOURCE_BUNDLE)); @@ -298,16 +281,12 @@ public class LoggerTest extends TestCase { * Test getAnonymousLogger(String resourceBundleName) with null resource * bundle. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getAnonymousLogger(String resourceBundleName) " + - "with null resource bundle.", - targets = { - @TestTarget( - methodName = "getAnonymousLogger", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getAnonymousLogger(String resourceBundleName) with null resource bundle.", + method = "getAnonymousLogger", + args = {java.lang.String.class} + ) public void testGetAnonymousLogger_NullResourceBundle() { Logger alog = Logger.getAnonymousLogger(null); assertNotSame(alog, Logger.getAnonymousLogger(null)); @@ -326,16 +305,12 @@ public class LoggerTest extends TestCase { * Test getAnonymousLogger(String resourceBundleName) with invalid resource * bundle. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getAnonymousLogger(String resourceBundleName) " + - "with invalid resource bundle.", - targets = { - @TestTarget( - methodName = "getAnonymousLogger", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getAnonymousLogger(String resourceBundleName) with invalid resource bundle.", + method = "getAnonymousLogger", + args = {java.lang.String.class} + ) public void testGetAnonymousLogger_InvalidResourceBundle() { try { Logger.getAnonymousLogger(INVALID_RESOURCE_BUNDLE); @@ -353,15 +328,12 @@ public class LoggerTest extends TestCase { /* * Test getLogger(String), getting a logger with no parent. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getLogger(String), getting a logger with no parent.", - targets = { - @TestTarget( - methodName = "getLogger", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getLogger(String), getting a logger with no parent.", + method = "getLogger", + args = {java.lang.String.class} + ) public void testGetLogger_Normal() throws Exception { // config the level Properties p = new Properties(); @@ -395,16 +367,12 @@ public class LoggerTest extends TestCase { /* * Test getLogger(String), getting a logger with invalid level configured. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getLogger(String), getting a logger with " + - "invalid level configured.", - targets = { - @TestTarget( - methodName = "getLogger", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getLogger(String), getting a logger with invalid level configured.", + method = "getLogger", + args = {java.lang.String.class} + ) public void testGetLogger_InvalidLevel() throws Exception { // config the level Properties p = new Properties(); @@ -430,15 +398,12 @@ public class LoggerTest extends TestCase { /* * Test getLogger(String) with null name. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getLogger(String) with null name.", - targets = { - @TestTarget( - methodName = "getLogger", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getLogger(String) with null name.", + method = "getLogger", + args = {java.lang.String.class} + ) public void testGetLogger_Null() { try { Logger.getLogger(null); @@ -457,15 +422,12 @@ public class LoggerTest extends TestCase { /* * Test getLogger(String) with invalid name. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getLogger(String) with invalid name.", - targets = { - @TestTarget( - methodName = "getLogger", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getLogger(String) with invalid name.", + method = "getLogger", + args = {java.lang.String.class} + ) public void testGetLogger_Invalid() { Logger log = Logger.getLogger("...#$%%^&&()-_+=!@~./,[]{};:'\\\"?|"); assertEquals("...#$%%^&&()-_+=!@~./,[]{};:'\\\"?|", log.getName()); @@ -474,16 +436,15 @@ public class LoggerTest extends TestCase { /* * Test getLogger(String) with empty name. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getLogger(String) with empty name.", - targets = { - @TestTarget( - methodName = "getLogger", - methodArgs = {java.lang.String.class} - ) - }) - public void _testGetLogger_Empty() { + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getLogger(String) with empty name.", + method = "getLogger", + args = {java.lang.String.class} + ) + @AndroidOnly("getResourceBundle and getResourceBundleName methods return " + + "null on RI for Logger with empty string name.") + public void testGetLogger_Empty() { assertNotNull(LogManager.getLogManager().getLogger("")); Logger log = Logger.getLogger(""); assertSame(log, LogManager.getLogManager().getLogger("")); @@ -493,24 +454,20 @@ public class LoggerTest extends TestCase { assertSame(Level.INFO, log.getLevel()); assertEquals("", log.getName()); assertNull(log.getParent()); + assertTrue(log.getUseParentHandlers()); assertNull(log.getResourceBundle()); assertNull(log.getResourceBundleName()); - assertTrue(log.getUseParentHandlers()); } /* * Test getLogger(String), getting a logger with existing parent. */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies getLogger(String), getting a logger " + - "with existing parent.", - targets = { - @TestTarget( - methodName = "getLogger", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getLogger(String), getting a logger with existing parent.", + method = "getLogger", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetLogger_WithParent() { assertNull(LogManager.getLogManager().getLogger( "testGetLogger_WithParent_ParentLogger")); @@ -597,16 +554,12 @@ public class LoggerTest extends TestCase { /* * Test getLogger(String, String), getting a logger with no parent. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getLogger(String, String), getting a logger " + - "with no parent.", - targets = { - @TestTarget( - methodName = "getLogger", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getLogger(String, String), getting a logger with no parent.", + method = "getLogger", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetLoggerWithRes_Normal() throws Exception { // config the level Properties p = new Properties(); @@ -640,15 +593,12 @@ public class LoggerTest extends TestCase { /* * Test getLogger(String, String) with null parameters. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getLogger(String, String) with null parameters.", - targets = { - @TestTarget( - methodName = "getLogger", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getLogger(String, String) with null parameters.", + method = "getLogger", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetLoggerWithRes_Null() { Logger.getLogger("testGetLoggerWithRes_Null_ANewLogger", null); try { @@ -662,17 +612,16 @@ public class LoggerTest extends TestCase { /* * Test getLogger(String, String) with invalid resource bundle. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getLogger(String, String) with invalid " + - "resource bundle.", - targets = { - @TestTarget( - methodName = "getLogger", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) - public void _testGetLoggerWithRes_InvalidResourceBundle() { + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getLogger(String, String) with invalid resource bundle.", + method = "getLogger", + args = {java.lang.String.class, java.lang.String.class} + ) + @KnownFailure("IllegalArgumentException is thrown instead of " + + "MissingResourceException if resource bundle with specified " + + "name can't be found.") + public void testGetLoggerWithRes_InvalidResourceBundle() { assertNull(LogManager.getLogManager().getLogger( "testMissingResourceException")); @@ -696,33 +645,25 @@ public class LoggerTest extends TestCase { // correct } - assertNull(LogManager.getLogManager().getLogger("")); + assertNotNull(LogManager.getLogManager().getLogger("")); // The root logger always exists TODO try { Logger.getLogger("", INVALID_RESOURCE_BUNDLE); - } - catch (MissingResourceException e) { + } catch (MissingResourceException e) { //correct } - - } /* * Test getLogger(String, String) with valid resource bundle, to get an * existing logger with no associated resource bundle. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getLogger(String, String) with valid resource " + - "bundle, to get an existing logger with no associated " + - "resource bundle.", - targets = { - @TestTarget( - methodName = "getLogger", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getLogger(String, String) with valid resource bundle, to get an existing logger with no associated resource bundle.", + method = "getLogger", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetLoggerWithRes_ExistingLoggerWithNoRes() { assertNull(LogManager.getLogManager().getLogger( "testGetLoggerWithRes_ExistingLoggerWithNoRes_ANewLogger")); @@ -743,17 +684,12 @@ public class LoggerTest extends TestCase { * Test getLogger(String, String) with valid resource bundle, to get an * existing logger with the same associated resource bundle. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getLogger(String, String) with valid resource " + - "bundle, to get an existing logger with the same associated " + - "resource bundle.", - targets = { - @TestTarget( - methodName = "getLogger", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getLogger(String, String) with valid resource bundle, to get an existing logger with the same associated resource bundle.", + method = "getLogger", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetLoggerWithRes_ExistingLoggerWithSameRes() { assertNull(LogManager.getLogManager().getLogger( "testGetLoggerWithRes_ExistingLoggerWithSameRes_ANewLogger")); @@ -774,17 +710,12 @@ public class LoggerTest extends TestCase { * Test getLogger(String, String) with valid resource bundle, to get an * existing logger with different associated resource bundle. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getLogger(String, String) with valid resource " + - "bundle, to get an existing logger with different associated " + - "resource bundle.", - targets = { - @TestTarget( - methodName = "getLogger", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getLogger(String, String) with valid resource bundle, to get an existing logger with different associated resource bundle.", + method = "getLogger", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetLoggerWithRes_ExistingLoggerWithDiffRes() { assertNull(LogManager.getLogManager().getLogger( "testGetLoggerWithRes_ExistingLoggerWithDiffRes_ANewLogger")); @@ -816,15 +747,12 @@ public class LoggerTest extends TestCase { /* * Test getLogger(String, String) with invalid name. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getLogger(String, String) with invalid name.", - targets = { - @TestTarget( - methodName = "getLogger", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getLogger(String, String) with invalid name.", + method = "getLogger", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetLoggerWithRes_InvalidName() { Logger log = Logger.getLogger( "...#$%%^&&()-_+=!@~./,[]{};:'\\\"?|WithRes", @@ -836,15 +764,12 @@ public class LoggerTest extends TestCase { /* * Test getLogger(String, String) with empty name. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getLogger(String, String) with empty name.", - targets = { - @TestTarget( - methodName = "getLogger", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getLogger(String, String) with empty name.", + method = "getLogger", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetLoggerWithRes_Empty() { Logger log = Logger.getLogger("", VALID_RESOURCE_BUNDLE); assertSame(log, LogManager.getLogManager().getLogger("")); @@ -862,16 +787,12 @@ public class LoggerTest extends TestCase { /* * Test getLogger(String, String), getting a logger with existing parent. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getLogger(String, String), getting a logger " + - "with existing parent.", - targets = { - @TestTarget( - methodName = "getLogger", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getLogger(String, String), getting a logger with existing parent.", + method = "getLogger", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetLoggerWithRes_WithParentNormal() { assertNull(LogManager.getLogManager().getLogger( "testGetLoggerWithRes_WithParent_ParentLogger")); @@ -903,15 +824,12 @@ public class LoggerTest extends TestCase { /* * Test addHandler(Handler) for a named logger with sufficient privilege. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "", - targets = { - @TestTarget( - methodName = "addHandler", - methodArgs = {java.util.logging.Handler.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "addHandler", + args = {java.util.logging.Handler.class} + ) public void testAddHandler_NamedLoggerSufficientPrivilege() { Logger log = Logger .getLogger("testAddHandler_NamedLoggerSufficientPrivilege"); @@ -926,15 +844,12 @@ public class LoggerTest extends TestCase { * Test addHandler(Handler) for a named logger with sufficient privilege, * add duplicate handlers. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "", - targets = { - @TestTarget( - methodName = "addHandler", - methodArgs = {java.util.logging.Handler.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "addHandler", + args = {java.util.logging.Handler.class} + ) public void testAddHandler_NamedLoggerSufficientPrivilegeDuplicate() { Logger log = Logger .getLogger("testAddHandler_NamedLoggerSufficientPrivilegeDuplicate"); @@ -952,15 +867,12 @@ public class LoggerTest extends TestCase { /* * Test addHandler(Handler) with a null handler. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies NullPointerException.", - targets = { - @TestTarget( - methodName = "addHandler", - methodArgs = {java.util.logging.Handler.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies NullPointerException.", + method = "addHandler", + args = {java.util.logging.Handler.class} + ) public void testAddHandler_Null() { Logger log = Logger.getLogger("testAddHandler_Null"); try { @@ -974,15 +886,12 @@ public class LoggerTest extends TestCase { /* * Test addHandler(Handler) for a named logger with insufficient privilege. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "", - targets = { - @TestTarget( - methodName = "addHandler", - methodArgs = {java.util.logging.Handler.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "addHandler", + args = {java.util.logging.Handler.class} + ) public void testAddHandler_NamedLoggerInsufficientPrivilege() { Logger log = Logger .getLogger("testAddHandler_NamedLoggerInsufficientPrivilege"); @@ -1003,15 +912,12 @@ public class LoggerTest extends TestCase { * Test addHandler(Handler) for a named logger with insufficient privilege, * using a null handler. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "", - targets = { - @TestTarget( - methodName = "addHandler", - methodArgs = {java.util.logging.Handler.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "addHandler", + args = {java.util.logging.Handler.class} + ) public void testAddHandler_NamedLoggerInsufficientPrivilegeNull() { Logger log = Logger .getLogger("testAddHandler_NamedLoggerInsufficientPrivilege"); @@ -1031,15 +937,12 @@ public class LoggerTest extends TestCase { * Test addHandler(Handler) for an anonymous logger with sufficient * privilege. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "", - targets = { - @TestTarget( - methodName = "addHandler", - methodArgs = {java.util.logging.Handler.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "addHandler", + args = {java.util.logging.Handler.class} + ) public void testAddHandler_AnonyLoggerSufficientPrivilege() { Logger log = Logger.getAnonymousLogger(); MockHandler h = new MockHandler(); @@ -1053,15 +956,12 @@ public class LoggerTest extends TestCase { * Test addHandler(Handler) for an anonymous logger with insufficient * privilege. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "", - targets = { - @TestTarget( - methodName = "addHandler", - methodArgs = {java.util.logging.Handler.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "addHandler", + args = {java.util.logging.Handler.class} + ) public void testAddHandler_AnonyLoggerInsufficientPrivilege() { Logger log = Logger.getAnonymousLogger(); MockHandler h = new MockHandler(); @@ -1081,16 +981,12 @@ public class LoggerTest extends TestCase { * Test addHandler(Handler) for a null-named mock logger with insufficient * privilege. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies addHandler(Handler) for a null-named mock logger " + - "with insufficient privilege, SecurityException.", - targets = { - @TestTarget( - methodName = "addHandler", - methodArgs = {java.util.logging.Handler.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies addHandler(Handler) for a null-named mock logger with insufficient privilege, SecurityException.", + method = "addHandler", + args = {java.util.logging.Handler.class} + ) public void testAddHandler_NullNamedMockLoggerInsufficientPrivilege() { MockLogger mlog = new MockLogger(null, null); MockHandler h = new MockHandler(); @@ -1109,9 +1005,12 @@ public class LoggerTest extends TestCase { * Test removeHandler(Handler) for a named logger with sufficient privilege, * remove an existing handler. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "addHandler", methodArgs = {Handler.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "addHandler", + args = {java.util.logging.Handler.class} + ) public void testRemoveHandler_NamedLoggerSufficientPrivilege() { Logger log = Logger .getLogger("testRemoveHandler_NamedLoggerSufficientPrivilege"); @@ -1126,9 +1025,12 @@ public class LoggerTest extends TestCase { * Test removeHandler(Handler) for a named logger with sufficient privilege, * remove a non-existing handler. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "removeHandler", methodArgs = {Handler.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "removeHandler", + args = {java.util.logging.Handler.class} + ) public void testRemoveHandler_NamedLoggerSufficientPrivilegeNotExisting() { Logger log = Logger .getLogger("testRemoveHandler_NamedLoggerSufficientPrivilegeNotExisting"); @@ -1141,9 +1043,12 @@ public class LoggerTest extends TestCase { /* * Test removeHandler(Handler) with a null handler. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "removeHandler", methodArgs = {Handler.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "removeHandler", + args = {java.util.logging.Handler.class} + ) public void testRemoveHandler_Null() { Logger log = Logger.getLogger("testRemoveHandler_Null"); log.removeHandler(null); @@ -1154,9 +1059,12 @@ public class LoggerTest extends TestCase { * Test removeHandler(Handler) for a named logger with insufficient * privilege. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "removeHandler", methodArgs = {Handler.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "removeHandler", + args = {java.util.logging.Handler.class} + ) public void testRemoveHandler_NamedLoggerInsufficientPrivilege() { Logger log = Logger .getLogger("testRemoveHandler_NamedLoggerInsufficientPrivilege"); @@ -1177,9 +1085,12 @@ public class LoggerTest extends TestCase { * Test removeHandler(Handler) for a named logger with insufficient * privilege, using a null handler. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "removeHandler", methodArgs = {Handler.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "removeHandler", + args = {java.util.logging.Handler.class} + ) public void testRemoveHandler_NamedLoggerInsufficientPrivilegeNull() { Logger log = Logger .getLogger("testRemoveHandler_NamedLoggerInsufficientPrivilege"); @@ -1199,9 +1110,12 @@ public class LoggerTest extends TestCase { * Test removeHandler(Handler) for an anonymous logger with sufficient * privilege. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "removeHandler", methodArgs = {Handler.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "removeHandler", + args = {java.util.logging.Handler.class} + ) public void testRemoveHandler_AnonyLoggerSufficientPrivilege() { Logger log = Logger.getAnonymousLogger(); MockHandler h = new MockHandler(); @@ -1215,9 +1129,12 @@ public class LoggerTest extends TestCase { * Test removeHandler(Handler) for an anonymous logger with insufficient * privilege. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "removeHandler", methodArgs = {Handler.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "removeHandler", + args = {java.util.logging.Handler.class} + ) public void testRemoveHandler_AnonyLoggerInsufficientPrivilege() { Logger log = Logger.getAnonymousLogger(); MockHandler h = new MockHandler(); @@ -1237,9 +1154,12 @@ public class LoggerTest extends TestCase { * Test removeHandler(Handler) for a null-named mock logger with * insufficient privilege. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "removeHandler", methodArgs = {Handler.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "removeHandler", + args = {java.util.logging.Handler.class} + ) public void testRemoveHandler_NullNamedMockLoggerInsufficientPrivilege() { MockLogger mlog = new MockLogger(null, null); MockHandler h = new MockHandler(); @@ -1257,15 +1177,12 @@ public class LoggerTest extends TestCase { /* * Test getHandlers() when there's no handler. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getHandlers() when there's no handler.", - targets = { - @TestTarget( - methodName = "getHandlers", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getHandlers() when there's no handler.", + method = "getHandlers", + args = {} + ) public void testGetHandlers_None() { Logger log = Logger.getLogger("testGetHandlers_None"); assertEquals(log.getHandlers().length, 0); @@ -1274,15 +1191,12 @@ public class LoggerTest extends TestCase { /* * Test getHandlers() when there are several handlers. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getHandlers() when there are several handlers.", - targets = { - @TestTarget( - methodName = "getHandlers", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getHandlers() when there are several handlers.", + method = "getHandlers", + args = {} + ) public void testGetHandlers_Several() { Logger log = Logger.getLogger("testGetHandlers_None"); assertEquals(log.getHandlers().length, 0); @@ -1308,18 +1222,18 @@ public class LoggerTest extends TestCase { * Test getFilter & setFilter with normal value for a named logger, having * sufficient privilege. */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies getFilter & setFilter with normal value " + - "for a named logger, having sufficient privilege.", - targets = { - @TestTarget( - methodName = "getFilter", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies getFilter & setFilter with normal value for a named logger, having sufficient privilege.", + method = "getFilter", + args = {} ), - @TestTarget( - methodName = "setFilter", - methodArgs = {java.util.logging.Filter.class} + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies getFilter & setFilter with normal value for a named logger, having sufficient privilege.", + method = "setFilter", + args = {java.util.logging.Filter.class} ) }) public void testGetSetFilter_NamedLoggerSufficientPrivilege() { @@ -1335,18 +1249,18 @@ public class LoggerTest extends TestCase { /* * Test getFilter & setFilter with null value, having sufficient privilege. */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies getFilter & setFilter with null value, " + - "having sufficient privilege.", - targets = { - @TestTarget( - methodName = "getFilter", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies getFilter & setFilter with null value, having sufficient privilege.", + method = "getFilter", + args = {} ), - @TestTarget( - methodName = "setFilter", - methodArgs = {java.util.logging.Filter.class} + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies getFilter & setFilter with null value, having sufficient privilege.", + method = "setFilter", + args = {java.util.logging.Filter.class} ) }) public void testGetSetFilter_Null() { @@ -1364,17 +1278,19 @@ public class LoggerTest extends TestCase { * Test setFilter with normal value for a named logger, having insufficient * privilege. */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies setFilter with normal value for a named logger, " + - "having insufficient privilege.", - targets = { - @TestTarget( - methodName = "getFilter", - methodArgs = {}), - @TestTarget( - methodName = "setFilter", - methodArgs = {Filter.class}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies setFilter with normal value for a named logger, having insufficient privilege.", + method = "getFilter", + args = {} + ), + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies setFilter with normal value for a named logger, having insufficient privilege.", + method = "setFilter", + args = {java.util.logging.Filter.class} + ) }) public void testGetSetFilter_NamedLoggerInsufficientPrivilege() { Logger log = Logger @@ -1394,10 +1310,20 @@ public class LoggerTest extends TestCase { /* * Test setFilter for an anonymous logger with sufficient privilege. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "getFilter", methodArgs = {}), - @TestTarget(methodName = "setFilter", methodArgs = {Filter.class})}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getFilter", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setFilter", + args = {java.util.logging.Filter.class} + ) + }) public void testSetFilter_AnonyLoggerSufficientPrivilege() { Logger log = Logger.getAnonymousLogger(); Filter f = new MockFilter(); @@ -1409,10 +1335,20 @@ public class LoggerTest extends TestCase { /* * Test setFilter for an anonymous logger with insufficient privilege. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "getFilter", methodArgs = {}), - @TestTarget(methodName = "setFilter", methodArgs = {Filter.class})}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getFilter", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setFilter", + args = {java.util.logging.Filter.class} + ) + }) public void testSetFilter_AnonyLoggerInsufficientPrivilege() { Logger log = Logger.getAnonymousLogger(); Filter f = new MockFilter(); @@ -1430,10 +1366,20 @@ public class LoggerTest extends TestCase { /* * Test setFilter for a null-named mock logger with insufficient privilege. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "getFilter", methodArgs = {}), - @TestTarget(methodName = "setFilter", methodArgs = {Filter.class})}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getFilter", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setFilter", + args = {java.util.logging.Filter.class} + ) + }) public void testSetFilter_NullNamedMockLoggerInsufficientPrivilege() { MockLogger mlog = new MockLogger(null, null); Filter f = new MockFilter(); @@ -1452,18 +1398,18 @@ public class LoggerTest extends TestCase { * Test getLevel & setLevel with normal value for a named logger, having * sufficient privilege. */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies getLevel & setLevel with normal value for " + - "a named logger, having sufficient privilege.", - targets = { - @TestTarget( - methodName = "setLevel", - methodArgs = {java.util.logging.Level.class} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies getLevel & setLevel with normal value for a named logger, having sufficient privilege.", + method = "setLevel", + args = {java.util.logging.Level.class} ), - @TestTarget( - methodName = "getLevel", - methodArgs = {} + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies getLevel & setLevel with normal value for a named logger, having sufficient privilege.", + method = "getLevel", + args = {} ) }) public void testGetSetLevel_NamedLoggerSufficientPrivilege() { @@ -1478,18 +1424,18 @@ public class LoggerTest extends TestCase { /* * Test getLevel & setLevel with null value, having sufficient privilege. */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies getLevel & setLevel with null value, " + - "having sufficient privilege.", - targets = { - @TestTarget( - methodName = "getLevel", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies getLevel & setLevel with null value, having sufficient privilege.", + method = "getLevel", + args = {} ), - @TestTarget( - methodName = "setLevel", - methodArgs = {java.util.logging.Level.class} + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies getLevel & setLevel with null value, having sufficient privilege.", + method = "setLevel", + args = {java.util.logging.Level.class} ) }) public void testGetSetLevel_Null() { @@ -1507,18 +1453,18 @@ public class LoggerTest extends TestCase { * Test setLevel with normal value for a named logger, having insufficient * privilege. */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies setLevel with normal value for a named logger, " + - "having insufficient privilege.", - targets = { - @TestTarget( - methodName = "setLevel", - methodArgs = {java.util.logging.Level.class} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies setLevel with normal value for a named logger, having insufficient privilege.", + method = "setLevel", + args = {java.util.logging.Level.class} ), - @TestTarget( - methodName = "getLevel", - methodArgs = {} + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies setLevel with normal value for a named logger, having insufficient privilege.", + method = "getLevel", + args = {} ) }) public void testGetSetLevel_NamedLoggerInsufficientPrivilege() { @@ -1538,10 +1484,20 @@ public class LoggerTest extends TestCase { /* * Test setLevel for an anonymous logger with sufficient privilege. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "getLevel", methodArgs = {}), - @TestTarget(methodName = "setLevel", methodArgs = {Level.class})}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getLevel", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setLevel", + args = {java.util.logging.Level.class} + ) + }) public void testSetLevel_AnonyLoggerSufficientPrivilege() { Logger log = Logger.getAnonymousLogger(); assertNull(log.getLevel()); @@ -1552,10 +1508,20 @@ public class LoggerTest extends TestCase { /* * Test setLevel for an anonymous logger with insufficient privilege. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "getLevel", methodArgs = {}), - @TestTarget(methodName = "setLevel", methodArgs = {Level.class})}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getLevel", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setLevel", + args = {java.util.logging.Level.class} + ) + }) public void testSetLevel_AnonyLoggerInsufficientPrivilege() { Logger log = Logger.getAnonymousLogger(); SecurityManager oldMan = System.getSecurityManager(); @@ -1572,10 +1538,20 @@ public class LoggerTest extends TestCase { /* * Test setLevel for a null-named mock logger with insufficient privilege. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "getLevel", methodArgs = {}), - @TestTarget(methodName = "setLevel", methodArgs = {Level.class})}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getLevel", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setLevel", + args = {java.util.logging.Level.class} + ) + }) public void testSetLevel_NullNamedMockLoggerInsufficientPrivilege() { MockLogger mlog = new MockLogger(null, null); SecurityManager oldMan = System.getSecurityManager(); @@ -1593,10 +1569,20 @@ public class LoggerTest extends TestCase { * Test getUseParentHandlers & setUseParentHandlers with normal value for a * named logger, having sufficient privilege. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "getUseParentHandlers", methodArgs = {}), - @TestTarget(methodName = "setUseParentHandlers", methodArgs = {boolean.class})}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getUseParentHandlers", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setUseParentHandlers", + args = {boolean.class} + ) + }) public void testGetSetUseParentHandlers_NamedLoggerSufficientPrivilege() { Logger log = Logger .getLogger("testGetSetUseParentHandlers_NamedLoggerSufficientPrivilege"); @@ -1610,10 +1596,20 @@ public class LoggerTest extends TestCase { * Test setUseParentHandlers with normal value for a named logger, having * insufficient privilege. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "getUseParentHandlers", methodArgs = {}), - @TestTarget(methodName = "setUseParentHandlers", methodArgs = {boolean.class})}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getUseParentHandlers", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setUseParentHandlers", + args = {boolean.class} + ) + }) public void testGetSetUseParentHandlers_NamedLoggerInsufficientPrivilege() { Logger log = Logger .getLogger("testGetSetUseParentHandlers_NamedLoggerInsufficientPrivilege"); @@ -1632,10 +1628,20 @@ public class LoggerTest extends TestCase { * Test setUseParentHandlers for an anonymous logger with sufficient * privilege. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "getUseParentHandlers", methodArgs = {}), - @TestTarget(methodName = "setUseParentHandlers", methodArgs = {boolean.class})}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getUseParentHandlers", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setUseParentHandlers", + args = {boolean.class} + ) + }) public void testSetUseParentHandlers_AnonyLoggerSufficientPrivilege() { Logger log = Logger.getAnonymousLogger(); assertTrue(log.getUseParentHandlers()); @@ -1647,10 +1653,20 @@ public class LoggerTest extends TestCase { * Test setUseParentHandlers for an anonymous logger with insufficient * privilege. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "getUseParentHandlers", methodArgs = {}), - @TestTarget(methodName = "setUseParentHandlers", methodArgs = {boolean.class})}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getUseParentHandlers", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setUseParentHandlers", + args = {boolean.class} + ) + }) public void testSetUseParentHandlers_AnonyLoggerInsufficientPrivilege() { Logger log = Logger.getAnonymousLogger(); SecurityManager oldMan = System.getSecurityManager(); @@ -1668,10 +1684,20 @@ public class LoggerTest extends TestCase { * Test setUseParentHandlers for a null-named mock logger with insufficient * privilege. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "getUseParentHandlers", methodArgs = {}), - @TestTarget(methodName = "setUseParentHandlers", methodArgs = {boolean.class})}) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getUseParentHandlers", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setUseParentHandlers", + args = {boolean.class} + ) + }) public void testSetUseParentHandlers_NullNamedMockLoggerInsufficientPrivilege() { MockLogger mlog = new MockLogger(null, null); SecurityManager oldMan = System.getSecurityManager(); @@ -1688,15 +1714,12 @@ public class LoggerTest extends TestCase { /* * Test getParent() for root logger. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getParent() for root logger.", - targets = { - @TestTarget( - methodName = "getParent", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getParent() for root logger.", + method = "getParent", + args = {} + ) public void testGetParent_Root() { assertNull(Logger.getLogger("").getParent()); } @@ -1704,15 +1727,12 @@ public class LoggerTest extends TestCase { /* * Test getParent() for normal named loggers. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getParent() for normal named loggers.", - targets = { - @TestTarget( - methodName = "getParent", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getParent() for normal named loggers.", + method = "getParent", + args = {} + ) public void testGetParent_NormalNamed() { Logger log = Logger.getLogger("testGetParent_NormalNamed"); assertSame(log.getParent(), Logger.getLogger("")); @@ -1725,15 +1745,12 @@ public class LoggerTest extends TestCase { /* * Test getParent() for anonymous loggers. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getParent() for anonymous loggers.", - targets = { - @TestTarget( - methodName = "getParent", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getParent() for anonymous loggers.", + method = "getParent", + args = {} + ) public void testGetParent_Anonymous() { assertSame(Logger.getAnonymousLogger().getParent(), Logger .getLogger("")); @@ -1743,9 +1760,12 @@ public class LoggerTest extends TestCase { * Test setParent(Logger) for the mock logger since it is advised not to * call this method on named loggers. Test normal conditions. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "setParent", methodArgs = {Logger.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setParent", + args = {java.util.logging.Logger.class} + ) public void testSetParent_Normal() { Logger log = new MockLogger(null, null); Logger parent = new MockLogger(null, null); @@ -1757,9 +1777,12 @@ public class LoggerTest extends TestCase { /* * Test setParent(Logger) with null. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "setParent", methodArgs = {Logger.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setParent", + args = {java.util.logging.Logger.class} + ) public void testSetParent_Null() { try { (new MockLogger(null, null)).setParent(null); @@ -1771,9 +1794,12 @@ public class LoggerTest extends TestCase { /* * Test setParent(Logger), having insufficient privilege. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "setParent", methodArgs = {Logger.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setParent", + args = {java.util.logging.Logger.class} + ) public void testSetParent_InsufficientPrivilege() { MockLogger log = new MockLogger(null, null); SecurityManager oldMan = System.getSecurityManager(); @@ -1790,9 +1816,12 @@ public class LoggerTest extends TestCase { /* * Test setParent(Logger) with null, having insufficient privilege. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "setParent", methodArgs = {Logger.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setParent", + args = {java.util.logging.Logger.class} + ) public void testSetParent_InsufficientPrivilegeNull() { MockLogger log = new MockLogger(null, null); SecurityManager oldMan = System.getSecurityManager(); @@ -1810,9 +1839,12 @@ public class LoggerTest extends TestCase { * Test setParent(Logger) for an anonymous logger with insufficient * privilege. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "setParent", methodArgs = {Logger.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setParent", + args = {java.util.logging.Logger.class} + ) public void testSetParent_AnonyLoggerInsufficientPrivilege() { Logger log = Logger.getAnonymousLogger(); SecurityManager oldMan = System.getSecurityManager(); @@ -1829,15 +1861,12 @@ public class LoggerTest extends TestCase { /* * Test getName() for normal names. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getName() for normal names.", - targets = { - @TestTarget( - methodName = "getName", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getName() for normal names.", + method = "getName", + args = {} + ) public void testGetName_Normal() { Logger log = Logger.getLogger("testGetName_Normal"); assertEquals("testGetName_Normal", log.getName()); @@ -1849,15 +1878,12 @@ public class LoggerTest extends TestCase { /* * Test getName() for empty name. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getName() for empty name.", - targets = { - @TestTarget( - methodName = "getName", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getName() for empty name.", + method = "getName", + args = {} + ) public void testGetName_Empty() { Logger log = Logger.getLogger(""); assertEquals("", log.getName()); @@ -1869,15 +1895,12 @@ public class LoggerTest extends TestCase { /* * Test getName() for null name. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getName() for null name.", - targets = { - @TestTarget( - methodName = "getName", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getName() for null name.", + method = "getName", + args = {} + ) public void testGetName_Null() { Logger log = Logger.getAnonymousLogger(); assertNull(log.getName()); @@ -1889,15 +1912,12 @@ public class LoggerTest extends TestCase { /* * Test getResourceBundle() when it it not null. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getResourceBundle() when it it not null.", - targets = { - @TestTarget( - methodName = "getResourceBundle", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getResourceBundle() when it it not null.", + method = "getResourceBundle", + args = {} + ) public void testGetResourceBundle_Normal() { Logger log = Logger.getLogger("testGetResourceBundle_Normal", VALID_RESOURCE_BUNDLE); @@ -1910,15 +1930,12 @@ public class LoggerTest extends TestCase { /* * Test getResourceBundle() when it it null. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getResourceBundle() when it it null.", - targets = { - @TestTarget( - methodName = "getResourceBundle", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getResourceBundle() when it it null.", + method = "getResourceBundle", + args = {} + ) public void testGetResourceBundle_Null() { Logger log = Logger.getLogger("testGetResourceBundle_Null", null); assertNull(log.getResourceBundle()); @@ -1931,15 +1948,12 @@ public class LoggerTest extends TestCase { /* * Test getResourceBundleName() when it it not null. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getResourceBundleName() when it it not null.", - targets = { - @TestTarget( - methodName = "getResourceBundleName", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getResourceBundleName() when it it not null.", + method = "getResourceBundleName", + args = {} + ) public void testGetResourceBundleName_Normal() { Logger log = Logger.getLogger("testGetResourceBundleName_Normal", VALID_RESOURCE_BUNDLE); @@ -1952,15 +1966,12 @@ public class LoggerTest extends TestCase { /* * Test getResourceBundleName() when it it null. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getResourceBundleName() when it it null.", - targets = { - @TestTarget( - methodName = "getResourceBundleName", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getResourceBundleName() when it it null.", + method = "getResourceBundleName", + args = {} + ) public void testGetResourceBundleName_Null() { Logger log = Logger.getLogger("testGetResourceBundleName_Null", null); assertNull(log.getResourceBundleName()); @@ -1973,9 +1984,12 @@ public class LoggerTest extends TestCase { /* * Test isLoggable(Level). */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "isLoggable", methodArgs = {Level.class}) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "isLoggable", + args = {java.util.logging.Level.class} + ) public void testIsLoggable() { MockLogger mlog = new MockLogger(null, null); assertNull(mlog.getLevel()); @@ -2009,10 +2023,12 @@ public class LoggerTest extends TestCase { /* * Test throwing(String, String, Throwable) with normal values. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "throwing", methodArgs = { - String.class, String.class, Throwable.class}) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "throwing", + args = {java.lang.String.class, java.lang.String.class, java.lang.Throwable.class} + ) public void testThrowing_Normal() { Throwable t = new Throwable(); this.sharedLogger.setLevel(Level.FINER); @@ -2041,10 +2057,12 @@ public class LoggerTest extends TestCase { /* * Test throwing(String, String, Throwable) with null values. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "throwing", methodArgs = { - String.class, String.class, Throwable.class}) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "throwing", + args = {java.lang.String.class, java.lang.String.class, java.lang.Throwable.class} + ) public void testThrowing_Null() { Logger child = new MockLogger("childLogger", null); Logger parent = new MockLogger("parentLogger", VALID_RESOURCE_BUNDLE2); @@ -2069,15 +2087,12 @@ public class LoggerTest extends TestCase { /* * Test entering(String, String) with normal values. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies entering(String, String) with normal values.", - targets = { - @TestTarget( - methodName = "entering", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies entering(String, String) with normal values.", + method = "entering", + args = {java.lang.String.class, java.lang.String.class} + ) public void testEntering_StringString_Normal() { this.sharedLogger.setLevel(Level.FINER); this.sharedLogger.entering("sourceClass", "sourceMethod"); @@ -2102,15 +2117,12 @@ public class LoggerTest extends TestCase { /* * Test entering(String, String) with null values. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies entering(String, String) with null values.", - targets = { - @TestTarget( - methodName = "entering", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies entering(String, String) with null values.", + method = "entering", + args = {java.lang.String.class, java.lang.String.class} + ) public void testEntering_StringString_Null() { Logger child = new MockLogger("childLogger", null); Logger parent = new MockLogger("parentLogger", VALID_RESOURCE_BUNDLE2); @@ -2135,15 +2147,12 @@ public class LoggerTest extends TestCase { /* * Test entering(String, String, Object) with normal values. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies entering(String, String, Object) with normal values.", - targets = { - @TestTarget( - methodName = "entering", - methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.Object.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies entering(String, String, Object) with normal values.", + method = "entering", + args = {java.lang.String.class, java.lang.String.class, java.lang.Object.class} + ) public void testEntering_StringStringObject_Normal() { Object param = new Object(); this.sharedLogger.setLevel(Level.FINER); @@ -2170,15 +2179,12 @@ public class LoggerTest extends TestCase { /* * Test entering(String, String, Object) with null values. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies entering(String, String, Object) with null values.", - targets = { - @TestTarget( - methodName = "entering", - methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.Object.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies entering(String, String, Object) with null values.", + method = "entering", + args = {java.lang.String.class, java.lang.String.class, java.lang.Object.class} + ) public void testEntering_StringStringObject_Null() { Logger child = new MockLogger("childLogger", null); Logger parent = new MockLogger("parentLogger", VALID_RESOURCE_BUNDLE2); @@ -2204,16 +2210,12 @@ public class LoggerTest extends TestCase { /* * Test entering(String, String, Object[]) with normal values. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies entering(String, String, Object[]) with normal " + - "values.", - targets = { - @TestTarget( - methodName = "entering", - methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.Object[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies entering(String, String, Object[]) with normal values.", + method = "entering", + args = {java.lang.String.class, java.lang.String.class, java.lang.Object[].class} + ) public void testEntering_StringStringObjects_Normal() { Object[] params = new Object[2]; params[0] = new Object(); @@ -2244,17 +2246,12 @@ public class LoggerTest extends TestCase { * Test entering(String, String, Object[]) with null class name and method * name and empty parameter array. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies entering(String, String, Object[]) with null class " + - "name and method name and empty parameter array.", - targets = { - @TestTarget( - methodName = "entering", - methodArgs = {java.lang.String.class, java.lang.String.class, - java.lang.Object[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies entering(String, String, Object[]) with null class name and method name and empty parameter array.", + method = "entering", + args = {java.lang.String.class, java.lang.String.class, java.lang.Object[].class} + ) public void testEntering_StringStringObjects_NullEmpty() { Logger child = new MockLogger("childLogger", null); Logger parent = new MockLogger("parentLogger", VALID_RESOURCE_BUNDLE2); @@ -2280,17 +2277,12 @@ public class LoggerTest extends TestCase { * Test entering(String, String, Object[]) with null values with appropriate * logging level set. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies entering(String, String, Object[]) with null " + - "values with appropriate logging level set.", - targets = { - @TestTarget( - methodName = "entering", - methodArgs = {java.lang.String.class, java.lang.String.class, - java.lang.Object[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies entering(String, String, Object[]) with null values with appropriate logging level set.", + method = "entering", + args = {java.lang.String.class, java.lang.String.class, java.lang.Object[].class} + ) public void testEntering_StringStringObjects_Null() { sharedLogger.setLevel(Level.FINER); sharedLogger.entering(null, null, (Object[]) null); @@ -2313,17 +2305,12 @@ public class LoggerTest extends TestCase { * Test entering(String, String, Object[]) with null values with * inappropriate logging level set. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies entering(String, String, Object[]) with null " + - "values with inappropriate logging level set.", - targets = { - @TestTarget( - methodName = "entering", - methodArgs = {java.lang.String.class, java.lang.String.class, - java.lang.Object[].class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies entering(String, String, Object[]) with null values with inappropriate logging level set.", + method = "entering", + args = {java.lang.String.class, java.lang.String.class, java.lang.Object[].class} + ) public void testEntering_StringStringObjects_NullDisabled() { this.sharedLogger.setLevel(Level.FINE); this.sharedLogger.entering(null, null, (Object[]) null); @@ -2333,15 +2320,12 @@ public class LoggerTest extends TestCase { /* * Test exiting(String, String) with normal values. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies exiting(String, String) with normal values.", - targets = { - @TestTarget( - methodName = "entering", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies exiting(String, String) with normal values.", + method = "exiting", + args = {java.lang.String.class, java.lang.String.class} + ) public void testExiting_StringString_Normal() { this.sharedLogger.setLevel(Level.FINER); this.sharedLogger.exiting("sourceClass", "sourceMethod"); @@ -2366,15 +2350,12 @@ public class LoggerTest extends TestCase { /* * Test exiting(String, String) with null values. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies exiting(String, String) with null values.", - targets = { - @TestTarget( - methodName = "exiting", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies exiting(String, String) with null values.", + method = "exiting", + args = {java.lang.String.class, java.lang.String.class} + ) public void testExiting_StringString_Null() { Logger child = new MockLogger("childLogger", null); Logger parent = new MockLogger("parentLogger", VALID_RESOURCE_BUNDLE2); @@ -2399,16 +2380,12 @@ public class LoggerTest extends TestCase { /* * Test exiting(String, String, Object) with normal values. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies exiting(String, String, Object) with normal values.", - targets = { - @TestTarget( - methodName = "exiting", - methodArgs = {java.lang.String.class, java.lang.String.class, - java.lang.Object.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies exiting(String, String, Object) with normal values.", + method = "exiting", + args = {java.lang.String.class, java.lang.String.class, java.lang.Object.class} + ) public void testExiting_StringStringObject_Normal() { Object param = new Object(); this.sharedLogger.setLevel(Level.FINER); @@ -2435,16 +2412,12 @@ public class LoggerTest extends TestCase { /* * Test exiting(String, String, Object) with null values. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies exiting(String, String, Object) with null values.", - targets = { - @TestTarget( - methodName = "exiting", - methodArgs = {java.lang.String.class, java.lang.String.class, - java.lang.Object.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies exiting(String, String, Object) with null values.", + method = "exiting", + args = {java.lang.String.class, java.lang.String.class, java.lang.Object.class} + ) public void testExiting_StringStringObject_Null() { Logger child = new MockLogger("childLogger", null); Logger parent = new MockLogger("parentLogger", VALID_RESOURCE_BUNDLE2); @@ -2470,15 +2443,12 @@ public class LoggerTest extends TestCase { /* * Test config(String) with normal values. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "", - targets = { - @TestTarget( - methodName = "config", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "config", + args = {java.lang.String.class} + ) public void testConfig_Normal() { this.sharedLogger.setLevel(Level.CONFIG); this.sharedLogger.config("config msg"); @@ -2503,15 +2473,12 @@ public class LoggerTest extends TestCase { /* * Test config(String) with null values. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies null as a parameter.", - targets = { - @TestTarget( - methodName = "config", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies null as a parameter.", + method = "config", + args = {java.lang.String.class} + ) public void testConfig_Null() { Logger child = new MockLogger("childLogger", null); Logger parent = new MockLogger("parentLogger", VALID_RESOURCE_BUNDLE2); @@ -2540,15 +2507,12 @@ public class LoggerTest extends TestCase { /* * Test fine(String) with normal values. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "", - targets = { - @TestTarget( - methodName = "fine", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "fine", + args = {java.lang.String.class} + ) public void testFine_Normal() { this.sharedLogger.setLevel(Level.FINE); this.sharedLogger.fine("fine msg"); @@ -2573,15 +2537,12 @@ public class LoggerTest extends TestCase { /* * Test fine(String) with null values. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies fine(String) with null values.", - targets = { - @TestTarget( - methodName = "fine", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies fine(String) with null values.", + method = "fine", + args = {java.lang.String.class} + ) public void testFine_Null() { Logger child = new MockLogger("childLogger", null); Logger parent = new MockLogger("parentLogger", VALID_RESOURCE_BUNDLE2); @@ -2610,15 +2571,12 @@ public class LoggerTest extends TestCase { /* * Test finer(String) with normal values. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies finer(String) with normal values.", - targets = { - @TestTarget( - methodName = "finer", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies finer(String) with normal values.", + method = "finer", + args = {java.lang.String.class} + ) public void testFiner_Normal() { this.sharedLogger.setLevel(Level.FINER); this.sharedLogger.finer("finer msg"); @@ -2643,15 +2601,12 @@ public class LoggerTest extends TestCase { /* * Test finer(String) with null values. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies finer(String) with null values.", - targets = { - @TestTarget( - methodName = "finer", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies finer(String) with null values.", + method = "finer", + args = {java.lang.String.class} + ) public void testFiner_Null() { Logger child = new MockLogger("childLogger", null); Logger parent = new MockLogger("parentLogger", VALID_RESOURCE_BUNDLE2); @@ -2680,15 +2635,12 @@ public class LoggerTest extends TestCase { /* * Test finest(String) with normal values. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies finest(String) with normal values.", - targets = { - @TestTarget( - methodName = "finest", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies finest(String) with normal values.", + method = "finest", + args = {java.lang.String.class} + ) public void testFinest_Normal() { this.sharedLogger.setLevel(Level.FINEST); this.sharedLogger.finest("finest msg"); @@ -2713,15 +2665,12 @@ public class LoggerTest extends TestCase { /* * Test finest(String) with null values. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies finest(String) with null values.", - targets = { - @TestTarget( - methodName = "finest", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies finest(String) with null values.", + method = "finest", + args = {java.lang.String.class} + ) public void testFinest_Null() { Logger child = new MockLogger("childLogger", null); Logger parent = new MockLogger("parentLogger", VALID_RESOURCE_BUNDLE2); @@ -2750,9 +2699,12 @@ public class LoggerTest extends TestCase { /* * Test info(String) with normal values. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "info", methodArgs = {String.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "info", + args = {java.lang.String.class} + ) public void testInfo_Normal() { this.sharedLogger.setLevel(Level.INFO); this.sharedLogger.info("info msg"); @@ -2777,9 +2729,12 @@ public class LoggerTest extends TestCase { /* * Test info(String) with null values. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "info", methodArgs = {String.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "info", + args = {java.lang.String.class} + ) public void testInfo_Null() { Logger child = new MockLogger("childLogger", null); Logger parent = new MockLogger("parentLogger", VALID_RESOURCE_BUNDLE2); @@ -2808,9 +2763,12 @@ public class LoggerTest extends TestCase { /* * Test warning(String) with normal values. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "warning", methodArgs = {String.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "warning", + args = {java.lang.String.class} + ) public void testWarning_Normal() { this.sharedLogger.setLevel(Level.WARNING); this.sharedLogger.warning("warning msg"); @@ -2835,9 +2793,12 @@ public class LoggerTest extends TestCase { /* * Test warning(String) with null values. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "warning", methodArgs = {String.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "warning", + args = {java.lang.String.class} + ) public void testWarning_Null() { Logger child = new MockLogger("childLogger", null); Logger parent = new MockLogger("parentLogger", VALID_RESOURCE_BUNDLE2); @@ -2866,9 +2827,12 @@ public class LoggerTest extends TestCase { /* * Test severe(String) with normal values. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "severe", methodArgs = {String.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "severe", + args = {java.lang.String.class} + ) public void testSevere_Normal() { this.sharedLogger.setLevel(Level.SEVERE); this.sharedLogger.severe("severe msg"); @@ -2893,9 +2857,12 @@ public class LoggerTest extends TestCase { /* * Test severe(String) with null values. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "severe", methodArgs = {String.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "severe", + args = {java.lang.String.class} + ) public void testSevere_Null() { Logger child = new MockLogger("childLogger", null); Logger parent = new MockLogger("parentLogger", VALID_RESOURCE_BUNDLE2); @@ -2924,9 +2891,12 @@ public class LoggerTest extends TestCase { /* * Test log(Level, String) with normal values. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "log", methodArgs = {Level.class, String.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.Level.class, java.lang.String.class} + ) public void testLog_LevelString_Normal() { this.sharedLogger.setLevel(Level.INFO); this.sharedLogger.log(Level.INFO, "log(Level, String) msg"); @@ -2953,9 +2923,12 @@ public class LoggerTest extends TestCase { /* * Test log(Level, String) with null message. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "log", methodArgs = {Level.class, String.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.Level.class, java.lang.String.class} + ) public void testLog_LevelString_NullMsg() { Logger child = new MockLogger("childLogger", null); Logger parent = new MockLogger("parentLogger", VALID_RESOURCE_BUNDLE2); @@ -2980,9 +2953,12 @@ public class LoggerTest extends TestCase { /* * Test log(Level, String) with null level. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "log", methodArgs = {Level.class, String.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.Level.class, java.lang.String.class} + ) public void testLog_LevelString_NullLevel() { // this.sharedLogger.setLevel(Level.OFF); try { @@ -2995,10 +2971,12 @@ public class LoggerTest extends TestCase { /* * Test log(Level, String, Object) with normal values. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "log", methodArgs = { - Level.class, String.class, Object.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.Object.class} + ) public void testLog_LevelStringObject_Normal() { Object param = new Object(); this.sharedLogger.setLevel(Level.INFO); @@ -3030,10 +3008,12 @@ public class LoggerTest extends TestCase { /* * Test log(Level, String, Object) with null message and object. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "log", methodArgs = { - Level.class, String.class, Object.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.Object.class} + ) public void testLog_LevelStringObject_NullMsgObj() { Logger child = new MockLogger("childLogger", null); Logger parent = new MockLogger("parentLogger", VALID_RESOURCE_BUNDLE2); @@ -3059,10 +3039,12 @@ public class LoggerTest extends TestCase { /* * Test log(Level, String, Object) with null level. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "log", methodArgs = { - Level.class, String.class, Object.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.Object.class} + ) public void testLog_LevelStringObject_NullLevel() { // this.sharedLogger.setLevel(Level.OFF); try { @@ -3076,10 +3058,12 @@ public class LoggerTest extends TestCase { /* * Test log(Level, String, Object[]) with normal values. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "log", methodArgs = { - Level.class, String.class, Object[].class}) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.Object[].class} + ) public void testLog_LevelStringObjects_Normal() { Object[] params = new Object[2]; @@ -3115,10 +3099,12 @@ public class LoggerTest extends TestCase { /* * Test log(Level, String, Object[]) with null message and object. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "log", methodArgs = { - Level.class, String.class, Object[].class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.Object[].class} + ) public void testLog_LevelStringObjects_NullMsgObj() { Logger child = new MockLogger("childLogger", null); Logger parent = new MockLogger("parentLogger", VALID_RESOURCE_BUNDLE2); @@ -3143,10 +3129,12 @@ public class LoggerTest extends TestCase { /* * Test log(Level, String, Object[]) with null level. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "log", methodArgs = { - Level.class, String.class, Object[].class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.Object[].class} + ) public void testLog_LevelStringObjects_NullLevel() { try { this.sharedLogger.log(null, "log(Level, String, Object[]) msg", @@ -3159,10 +3147,12 @@ public class LoggerTest extends TestCase { /* * Test log(Level, String, Throwable) with normal values. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "log", methodArgs = { - Level.class, String.class, Throwable.class}) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.Throwable.class} + ) public void testLog_LevelStringThrowable_Normal() { Throwable t = new Throwable(); this.sharedLogger.setLevel(Level.INFO); @@ -3193,10 +3183,12 @@ public class LoggerTest extends TestCase { /* * Test log(Level, String, Throwable) with null message and throwable. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "log", methodArgs = { - Level.class, String.class, Throwable.class}) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.Throwable.class} + ) public void testLog_LevelStringThrowable_Null() { Logger child = new MockLogger("childLogger", null); Logger parent = new MockLogger("parentLogger", VALID_RESOURCE_BUNDLE2); @@ -3221,10 +3213,12 @@ public class LoggerTest extends TestCase { /* * Test log(Level, String, Throwable) with null level. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "log", methodArgs = { - Level.class, String.class, Throwable.class}) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.Throwable.class} + ) public void testLog_LevelStringThrowable_NullLevel() { // this.sharedLogger.setLevel(Level.OFF); try { @@ -3238,9 +3232,12 @@ public class LoggerTest extends TestCase { /* * Test logp(Level, String, String, String) with normal values. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "logp", methodArgs = { - Level.class, String.class, String.class, String.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logp", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testLogp_LevelStringStringString_Normal() { this.sharedLogger.setLevel(Level.INFO); this.sharedLogger.logp(Level.INFO, "sourceClass", "sourceMethod", @@ -3270,9 +3267,12 @@ public class LoggerTest extends TestCase { /* * Test logp(Level, String, String, String) with null message. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "logp", methodArgs = { - Level.class, String.class, String.class, String.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logp", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testLogp_LevelStringStringString_NullMsg() { Logger child = new MockLogger("childLogger", null); Logger parent = new MockLogger("parentLogger", VALID_RESOURCE_BUNDLE2); @@ -3297,9 +3297,12 @@ public class LoggerTest extends TestCase { /* * Test logp(Level, String, String, String) with null level. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "logp", methodArgs = { - Level.class, String.class, String.class, String.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logp", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testLogp_LevelStringStringString_NullLevel() { // this.sharedLogger.setLevel(Level.OFF); try { @@ -3313,9 +3316,12 @@ public class LoggerTest extends TestCase { /* * Test logp(Level, String, String, String, Object) with normal values. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "logp", methodArgs = { - Level.class, String.class, String.class, String.class, Object.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logp", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Object.class} + ) public void testLogp_LevelStringStringStringObject_Normal() { Object param = new Object(); this.sharedLogger.setLevel(Level.INFO); @@ -3349,9 +3355,12 @@ public class LoggerTest extends TestCase { * Test logp(Level, String, String, String, Object) with null message and * object. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "logp", methodArgs = { - Level.class, String.class, String.class, String.class, Object.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logp", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Object.class} + ) public void testLogp_LevelStringStringStringObject_NullMsgObj() { Logger child = new MockLogger("childLogger", null); Logger parent = new MockLogger("parentLogger", VALID_RESOURCE_BUNDLE2); @@ -3377,9 +3386,12 @@ public class LoggerTest extends TestCase { /* * Test logp(Level, String, String, String, Object) with null level. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "logp", methodArgs = { - Level.class, String.class, String.class, String.class, Object.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logp", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Object.class} + ) public void testLogp_LevelStringStringStringObject_NullLevel() { // this.sharedLogger.setLevel(Level.OFF); @@ -3395,10 +3407,12 @@ public class LoggerTest extends TestCase { /* * Test logp(Level, String, String, String, Object[]) with normal values. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "logp", methodArgs = { - Level.class, String.class, String.class, String.class, Object[].class}) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logp", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Object[].class} + ) public void testLogp_LevelStringStringStringObjects_Normal() { Object[] params = new Object[2]; @@ -3436,10 +3450,12 @@ public class LoggerTest extends TestCase { * Test logp(Level, String, String, String, Object[]) with null message and * object. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "logp", methodArgs = { - Level.class, String.class, String.class, String.class, Object[].class}) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logp", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Object[].class} + ) public void testLogp_LevelStringStringStringObjects_NullMsgObj() { Logger child = new MockLogger("childLogger", null); Logger parent = new MockLogger("parentLogger", VALID_RESOURCE_BUNDLE2); @@ -3464,10 +3480,12 @@ public class LoggerTest extends TestCase { /* * Test logp(Level, String, String, String, Object[]) with null level. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "logp", methodArgs = { - Level.class, String.class, String.class, String.class, Object[].class}) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logp", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Object[].class} + ) public void testLogp_LevelStringStringStringObjects_NullLevel() { // this.sharedLogger.setLevel(Level.OFF); try { @@ -3482,10 +3500,12 @@ public class LoggerTest extends TestCase { /* * Test logp(Level, String, String, String, Throwable) with normal values. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "logp", methodArgs = { - Level.class, String.class, String.class, String.class, - Throwable.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logp", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Throwable.class} + ) public void testLogp_LevelStringStringStringThrowable_Normal() { Throwable t = new Throwable(); this.sharedLogger.setLevel(Level.INFO); @@ -3518,10 +3538,12 @@ public class LoggerTest extends TestCase { * Test logp(Level, String, String, String, Throwable) with null message and * throwable. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "logp", methodArgs = { - Level.class, String.class, String.class, String.class, - Throwable.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logp", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Throwable.class} + ) public void testLogp_LevelStringStringStringThrowable_Null() { Logger child = new MockLogger("childLogger", null); Logger parent = new MockLogger("parentLogger", VALID_RESOURCE_BUNDLE2); @@ -3546,10 +3568,12 @@ public class LoggerTest extends TestCase { /* * Test logp(Level, String, String, String, Throwable) with null level. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "logp", methodArgs = { - Level.class, String.class, String.class, String.class, - Throwable.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logp", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Throwable.class} + ) public void testLogp_LevelStringStringStringThrowable_NullLevel() { // this.sharedLogger.setLevel(Level.OFF); try { @@ -3564,9 +3588,12 @@ public class LoggerTest extends TestCase { /* * Test logrb(Level, String, String, String, String) with normal values. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "logrb", methodArgs = { - Level.class, String.class, String.class, String.class, String.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logrb", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testLogrb_LevelStringStringString_Normal() { this.sharedLogger.setLevel(Level.INFO); this.sharedLogger.logrb(Level.INFO, "sourceClass", "sourceMethod", @@ -3599,9 +3626,12 @@ public class LoggerTest extends TestCase { /* * Test logrb(Level, String, String, String, String) with null message. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "logrb", methodArgs = { - Level.class, String.class, String.class, String.class, String.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logrb", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testLogrb_LevelStringStringString_NullMsg() { this.sharedLogger.setLevel(Level.INFO); this.sharedLogger.logrb(Level.INFO, null, null, null, null); @@ -3620,9 +3650,12 @@ public class LoggerTest extends TestCase { /* * Test logrb(Level, String, String, String) with null level. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "logrb", methodArgs = { - Level.class, String.class, String.class, String.class, String.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logrb", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testLogrb_LevelStringStringString_NullLevel() { try { this.sharedLogger.logrb(null, "sourceClass", "sourceMethod", @@ -3637,9 +3670,12 @@ public class LoggerTest extends TestCase { * Test logrb(Level, String, String, String, String) with invalid resource * bundle. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "logrb", methodArgs = { - Level.class, String.class, String.class, String.class, String.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logrb", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testLogrb_LevelStringStringString_InvalidRes() { this.sharedLogger.setLevel(Level.ALL); this.sharedLogger.logrb(Level.ALL, "sourceClass", "sourceMethod", @@ -3663,10 +3699,12 @@ public class LoggerTest extends TestCase { * Test logrb(Level, String, String, String, String, Object) with normal * values. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "logrb", methodArgs = { - Level.class, String.class, String.class, String.class, - String.class, Object.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logrb", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Object.class} + ) public void testLogrb_LevelStringStringStringObject_Normal() { Object param = new Object(); this.sharedLogger.setLevel(Level.INFO); @@ -3704,10 +3742,12 @@ public class LoggerTest extends TestCase { * Test logrb(Level, String, String, String, String, Object) with null * message and object. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "logrb", methodArgs = { - Level.class, String.class, String.class, String.class, - String.class, Object.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logrb", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Object.class} + ) public void testLogrb_LevelStringStringStringObject_NullMsgObj() { this.sharedLogger.setLevel(Level.INFO); this.sharedLogger.logrb(Level.INFO, null, null, null, null, @@ -3729,17 +3769,12 @@ public class LoggerTest extends TestCase { * java.util.logging.Logger#logrb(Level, String, String, String, String, * Object) */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Regression test.", - targets = { - @TestTarget( - methodName = "logrb", - methodArgs = {java.util.logging.Level.class, java.lang.String.class, - java.lang.String.class, java.lang.String.class, - java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Regression test.", + method = "logrb", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void test_logrbLLevel_LString_LString_LObject_Security() throws Exception { // regression test for Harmony-1290 @@ -3756,10 +3791,12 @@ public class LoggerTest extends TestCase { * Test logrb(Level, String, String, String, String, Object) with null * level. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "logrb", methodArgs = { - Level.class, String.class, String.class, String.class, - String.class, Object.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logrb", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Object.class} + ) public void testLogrb_LevelStringStringStringObject_NullLevel() { // this.sharedLogger.setLevel(Level.OFF); try { @@ -3776,10 +3813,12 @@ public class LoggerTest extends TestCase { * Test logrb(Level, String, String, String, String, Object) with invalid * resource bundle. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "logrb", methodArgs = { - Level.class, String.class, String.class, String.class, - String.class, Object.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logrb", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Object.class} + ) public void testLogrb_LevelStringStringStringObject_InvalidRes() { Object param = new Object(); this.sharedLogger.setLevel(Level.ALL); @@ -3805,11 +3844,12 @@ public class LoggerTest extends TestCase { * Test logrb(Level, String, String, String, String, Object[]) with normal * values. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "logrb", methodArgs = { - Level.class, String.class, String.class, String.class, - String.class, Object[].class}) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logrb", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Object[].class} + ) public void testLogrb_LevelStringStringStringObjects_Normal() { Object[] params = new Object[2]; params[0] = new Object(); @@ -3850,11 +3890,12 @@ public class LoggerTest extends TestCase { * Test logrb(Level, String, String, String, String, Object[]) with null * message and object. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "logrb", methodArgs = { - Level.class, String.class, String.class, String.class, - String.class, Object[].class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logrb", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Object[].class} + ) public void testLogrb_LevelStringStringStringObjects_NullMsgObj() { this.sharedLogger.setLevel(Level.INFO); this.sharedLogger.logrb(Level.INFO, null, null, null, null, @@ -3875,11 +3916,12 @@ public class LoggerTest extends TestCase { * Test logrb(Level, String, String, String, String, Object[]) with null * level. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "logrb", methodArgs = { - Level.class, String.class, String.class, String.class, - String.class, Object[].class}) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logrb", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Object[].class} + ) public void testLogrb_LevelStringStringStringObjects_NullLevel() { try { this.sharedLogger.logrb( @@ -3898,11 +3940,12 @@ public class LoggerTest extends TestCase { * Test logrb(Level, String, String, String, String, Object[]) with invalid * resource bundle. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "logrb", methodArgs = { - Level.class, String.class, String.class, String.class, - String.class, Object[].class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logrb", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Object[].class} + ) public void testLogrb_LevelStringStringStringObjects_InvalidRes() { Object[] params = new Object[2]; params[0] = new Object(); @@ -3931,11 +3974,12 @@ public class LoggerTest extends TestCase { * Test logrb(Level, String, String, String, String, Throwable) with normal * values. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "logrb", methodArgs = { - Level.class, String.class, String.class, String.class, - String.class, Throwable.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logrb", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Throwable.class} + ) public void testLogrb_LevelStringStringStringThrowable_Normal() { Throwable t = new Throwable(); this.sharedLogger.setLevel(Level.INFO); @@ -3973,11 +4017,12 @@ public class LoggerTest extends TestCase { * Test logrb(Level, String, String, String, String, Throwable) with null * message and throwable. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "logrb", methodArgs = { - Level.class, String.class, String.class, String.class, - String.class, Throwable.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logrb", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Throwable.class} + ) public void testLogrb_LevelStringTStringStringhrowable_NullMsgObj() { this.sharedLogger.setLevel(Level.INFO); this.sharedLogger.logrb(Level.INFO, null, null, null, null, @@ -3998,11 +4043,12 @@ public class LoggerTest extends TestCase { * Test logrb(Level, String, String, String, String, Throwable) with null * level. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "logrb", methodArgs = { - Level.class, String.class, String.class, String.class, - String.class, Throwable.class}) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logrb", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Throwable.class} + ) public void testLogrb_LevelStringStringStringThrowable_NullLevel() { // this.sharedLogger.setLevel(Level.OFF); try { @@ -4022,11 +4068,12 @@ public class LoggerTest extends TestCase { * Test logrb(Level, String, String, String, String, Throwable) with invalid * resource bundle. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "logrb", methodArgs = { - Level.class, String.class, String.class, String.class, - String.class, Throwable.class}) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "logrb", + args = {java.util.logging.Level.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Throwable.class} + ) public void testLogrb_LevelStringStringStringThrowable_InvalidRes() { Throwable t = new Throwable(); this.sharedLogger.setLevel(Level.ALL); @@ -4051,9 +4098,12 @@ public class LoggerTest extends TestCase { * Test log(LogRecord) for a normal log record. Meanwhile the logger has an * appropriate level, no filter, no parent. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "log", methodArgs = {LogRecord.class}) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.LogRecord.class} + ) public void testLog_LogRecord_AppropriateLevelNoFilterNoParent() { LogRecord r = new LogRecord(Level.INFO, "testLog_LogRecord_AppropriateLevelNoFilterNoParent"); @@ -4077,9 +4127,12 @@ public class LoggerTest extends TestCase { /* * Test log(LogRecord) with null log record. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - @TestTarget(methodName = "log", methodArgs = {LogRecord.class}) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.LogRecord.class} + ) public void testLog_LogRecord_Null() { this.sharedLogger.setLevel(Level.INFO); try { @@ -4093,9 +4146,12 @@ public class LoggerTest extends TestCase { * Test log(LogRecord) for a normal log record. Meanwhile the logger has an * inappropriate level, no filter, no parent. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "log", methodArgs = {LogRecord.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.LogRecord.class} + ) public void testLog_LogRecord_InppropriateLevelNoFilterNoParent() { LogRecord r = new LogRecord(Level.INFO, "testLog_LogRecord_InppropriateLevelNoFilterNoParent"); @@ -4114,9 +4170,12 @@ public class LoggerTest extends TestCase { * Test log(LogRecord) for a normal log record. Meanwhile the logger has an * appropriate level, a filter that accepts the fed log record, no parent. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "log", methodArgs = {LogRecord.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.LogRecord.class} + ) public void testLog_LogRecord_AppropriateLevelTrueFilterNoParent() { LogRecord r = new LogRecord(Level.INFO, "testLog_LogRecord_AppropriateLevelTrueFilterNoParent"); @@ -4145,9 +4204,12 @@ public class LoggerTest extends TestCase { * Test log(LogRecord) for a normal log record. Meanwhile the logger has an * appropriate level, a filter that rejects the fed log record, no parent. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "log", methodArgs = {LogRecord.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.LogRecord.class} + ) public void testLog_LogRecord_AppropriateLevelFalseFilterNoParent() { LogRecord r = new LogRecord(Level.INFO, "testLog_LogRecord_AppropriateLevelFalseFilterNoParent"); @@ -4175,9 +4237,12 @@ public class LoggerTest extends TestCase { * Test that the parent's handler is notified for a new log record when * getUseParentHandlers() is true. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "log", methodArgs = {LogRecord.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.LogRecord.class} + ) public void testLog_ParentInformed() { Logger child = new MockLogger("childLogger", VALID_RESOURCE_BUNDLE); Logger parent = new MockParentLogger("parentLogger", @@ -4230,9 +4295,12 @@ public class LoggerTest extends TestCase { * Test that the ancestor's handler is notified for a new log record when * getUseParentHandlers() is true. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "log", methodArgs = {LogRecord.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.LogRecord.class} + ) public void testLog_AncestorInformed() { Logger child = new MockLogger("childLogger", VALID_RESOURCE_BUNDLE); Logger parent = new MockParentLogger("parentLogger", @@ -4279,9 +4347,12 @@ public class LoggerTest extends TestCase { * Test that the parent's handler is notified for a new log record when * getUseParentHandlers() is false. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "log", methodArgs = {LogRecord.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.LogRecord.class} + ) public void testLog_ParentNotInformed() { Logger child = new MockLogger("childLogger", VALID_RESOURCE_BUNDLE); Logger parent = new MockParentLogger("parentLogger", @@ -4302,9 +4373,12 @@ public class LoggerTest extends TestCase { * Test that a logger with null level and no parent. Defaulted to * Level.INFO. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "log", methodArgs = {LogRecord.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.LogRecord.class} + ) public void testLog_NullLevelNoParent() { LogRecord r = new LogRecord(Level.INFO, "testLog_NullLevelNoParent"); assertNull(this.sharedLogger.getLevel()); @@ -4330,9 +4404,12 @@ public class LoggerTest extends TestCase { /* * Test that a logger inherits its parent level when its level is null. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "log", methodArgs = {LogRecord.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.LogRecord.class} + ) public void testLog_NullLevelHasParent() { Logger child = new MockLogger("childLogger", VALID_RESOURCE_BUNDLE); Logger parent = new MockLogger("parentLogger", VALID_RESOURCE_BUNDLE2); @@ -4385,9 +4462,12 @@ public class LoggerTest extends TestCase { * Test that a logger with null resource bundle and no parent. Defaulted to * null. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "log", methodArgs = {LogRecord.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.LogRecord.class} + ) public void testLog_NullResNoParent() { Logger log = new MockLogger("Logger", null); log.addHandler(new MockHandler()); @@ -4409,9 +4489,12 @@ public class LoggerTest extends TestCase { * Test that a logger inherits its parent resource bundle when its resource * bundle is null. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "log", methodArgs = {LogRecord.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.LogRecord.class} + ) public void testLog_NullResHasParent() { Logger child = new MockLogger("childLogger", null); Logger parent = new MockLogger("parentLogger", VALID_RESOURCE_BUNDLE2); @@ -4442,9 +4525,12 @@ public class LoggerTest extends TestCase { * Test that a logger inherits its ancestor's resource bundle when its * resource bundle and its parent's resource bundle are both null. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "log", methodArgs = {LogRecord.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.LogRecord.class} + ) public void testLog_NullResHasAncestor() { Logger child = new MockLogger("childLogger", null); Logger parent = new MockLogger("parentLogger", null); @@ -4477,9 +4563,12 @@ public class LoggerTest extends TestCase { /* * Test when one handler throws an exception. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", targets = { - - @TestTarget(methodName = "log", methodArgs = {LogRecord.class})}) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "log", + args = {java.util.logging.LogRecord.class} + ) public void testLog_ExceptionalHandler() { MockLogger l = new MockLogger("testLog_ExceptionalHandler", null); l.addHandler(new MockExceptionalHandler()); @@ -4495,10 +4584,12 @@ public class LoggerTest extends TestCase { /* * Test whether privileged code is used to load resource bundles. */ - @TestInfo(level = TestLevel.COMPLETE, purpose = "", - targets = { - @TestTarget(methodName = "getAnonymousLogger", methodArgs = {String.class}) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getAnonymousLogger", + args = {java.lang.String.class} + ) public void testLoadResourceBundle() { // SecurityManager oldMan = System.getSecurityManager(); @@ -4515,16 +4606,13 @@ public class LoggerTest extends TestCase { * java.util.logging.Logger#logrb(Level, String, String, String, String, * Object) */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "", - targets = { - @TestTarget( - methodName = "getLogger", - methodArgs = {java.lang.String.class} - ) - }) - public void _test_init_logger() throws Exception { + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getLogger", + args = {java.lang.String.class} + ) + public void test_init_logger() throws Exception { Properties p = new Properties(); p.put("testGetLogger_Normal_ANewLogger2.level", "ALL"); LogManager.getLogManager().readConfiguration( @@ -4534,11 +4622,9 @@ public class LoggerTest extends TestCase { "testGetLogger_Normal_ANewLogger2")); SecurityManager originalSecurityManager = System.getSecurityManager(); try { - System.setSecurityManager(new MockSecurityManager()); - // should not throw expection Logger logger = Logger - .getLogger("testGetLogger_Normal_ANewLogger2"); - // should throw exception + .getLogger("testGetLogger_Normal_ANewLogger2"); + System.setSecurityManager(new MockSecurityManager()); try { logger.setLevel(Level.ALL); fail("should throw SecurityException"); diff --git a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggingMXBeanTest.java b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggingMXBeanTest.java index cfbf213..c9b7d50 100644 --- a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggingMXBeanTest.java +++ b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggingMXBeanTest.java @@ -17,8 +17,8 @@ package org.apache.harmony.logging.tests.java.util.logging; import dalvik.annotation.TestTargetClass; -import dalvik.annotation.TestInfo; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargets; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestLevel; import junit.framework.TestCase; @@ -53,55 +53,43 @@ public class LoggingMXBeanTest extends TestCase { - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "getLoggerLevel", - methodArgs = {String.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getLoggerLevel", + args = {java.lang.String.class} + ) public void testGetLoggerLevel() { assertNull(m.getLoggerLevel(null)); } - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "getLoggerNames", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getLoggerNames", + args = {} + ) public void testGetLoggerNames() { assertNull(m.getLoggerNames()); } - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "getParentLoggerName", - methodArgs = {String.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getParentLoggerName", + args = {java.lang.String.class} + ) public void testGetParentLoggerName() { assertNull(m.getParentLoggerName(null)); } - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "setLoggerLevel", - methodArgs = {String.class, String.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setLoggerLevel", + args = {java.lang.String.class, java.lang.String.class} + ) public void testSetLoggerLevel() { try{ m.setLoggerLevel(null,null); diff --git a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggingPermissionTest.java b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggingPermissionTest.java index bc82d65..9507bbd 100644 --- a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggingPermissionTest.java +++ b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/LoggingPermissionTest.java @@ -17,9 +17,9 @@ package org.apache.harmony.logging.tests.java.util.logging; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import java.util.logging.LoggingPermission; @@ -34,16 +34,12 @@ public class LoggingPermissionTest extends TestCase { /** * @tests serialization/deserialization compatibility. */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - - @TestTarget( - methodName = "!SerializationSelf", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "!SerializationSelf", + args = {} + ) public void testSerializationSelf() throws Exception { SerializationTest.verifySelf(new LoggingPermission("control", "")); } @@ -51,32 +47,24 @@ public class LoggingPermissionTest extends TestCase { /** * @tests serialization/deserialization compatibility with RI. */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - - @TestTarget( - methodName = "!SerializationGolden", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "!SerializationGolden", + args = {} + ) public void testSerializationCompatibility() throws Exception { SerializationTest.verifyGolden(this, new LoggingPermission("control", "")); } - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - - @TestTarget( - methodName = "LoggingPermission", - methodArgs = {String.class, String.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "LoggingPermission", + args = {java.lang.String.class, java.lang.String.class} + ) public void testLoggingPermission() { try { new LoggingPermission(null, null); diff --git a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/MemoryHandlerTest.java b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/MemoryHandlerTest.java index eda7514..9aa344a 100644 --- a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/MemoryHandlerTest.java +++ b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/MemoryHandlerTest.java @@ -17,9 +17,9 @@ package org.apache.harmony.logging.tests.java.util.logging; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import java.io.IOException; @@ -107,40 +107,50 @@ public class MemoryHandlerTest extends TestCase { System.setErr(err); } - @TestInfo( + @TestTargets({ + @TestTargetNew( level = TestLevel.COMPLETE, - purpose = "SecurityException", - targets = { - @TestTarget( - methodName = "close", - methodArgs = {} - ), - @TestTarget( - methodName = "setPushLevel", - methodArgs = {Level.class} - ), - @TestTarget( - methodName = "flush", - methodArgs = {} - ), - @TestTarget( - methodName = "push", - methodArgs = {} - ), - @TestTarget( - methodName = "getPushLevel", - methodArgs = {} - ), - @TestTarget( - methodName = "isLoggable", - methodArgs = {LogRecord.class} - ), - @TestTarget( - methodName = "publish", - methodArgs = {LogRecord.class} - ) - - }) + notes = "SecurityException", + method = "close", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "SecurityException", + method = "setPushLevel", + args = {java.util.logging.Level.class} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "SecurityException", + method = "flush", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "SecurityException", + method = "push", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "SecurityException", + method = "getPushLevel", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "SecurityException", + method = "isLoggable", + args = {java.util.logging.LogRecord.class} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "SecurityException", + method = "publish", + args = {java.util.logging.LogRecord.class} + ) + }) public void testGlobalSecurity() { SecurityManager currentManager = System.getSecurityManager(); System.setSecurityManager(securityManager); @@ -166,15 +176,12 @@ public class MemoryHandlerTest extends TestCase { } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "not a good test, try to improve", - targets = { - @TestTarget( - methodName = "close", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "close", + args = {} + ) public void testClose() { Filter filter = handler.getFilter(); Formatter formatter = handler.getFormatter(); @@ -190,15 +197,12 @@ public class MemoryHandlerTest extends TestCase { assertFalse(handler.isLoggable(new LogRecord(Level.SEVERE, "test"))); } - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "not a good test, try to improve", - targets = { - @TestTarget( - methodName = "flush", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "flush", + args = {} + ) public void testFlush() { Filter filter = handler.getFilter(); Formatter formatter = handler.getFormatter(); @@ -214,15 +218,12 @@ public class MemoryHandlerTest extends TestCase { assertTrue(handler.isLoggable(new LogRecord(Level.SEVERE, "test"))); } - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "isLoggable", - methodArgs = {LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "isLoggable", + args = {java.util.logging.LogRecord.class} + ) public void testIsLoggable() { try { handler.isLoggable(null); @@ -254,14 +255,12 @@ public class MemoryHandlerTest extends TestCase { /* * Class under test for void MemoryHandler() */ - @TestInfo - (level = TestLevel.PARTIAL, - purpose = "check errors", - targets = - { - @TestTarget(methodName = "MemoryHandler", methodArgs = {}) - } - ) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "check errors", + method = "MemoryHandler", + args = {} + ) public void testMemoryHandler() throws IOException { assertNotNull("Filter should not be null", handler.getFilter()); assertNotNull("Formatter should not be null", handler.getFormatter()); @@ -288,14 +287,12 @@ public class MemoryHandlerTest extends TestCase { } - @TestInfo - (level = TestLevel.COMPLETE, - purpose = "", - targets = - { - @TestTarget(methodName = "MemoryHandler", methodArgs = {}) - } - ) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "MemoryHandler", + args = {} + ) public void testMemoryHandlerInvalidProps() throws IOException { // null target try { @@ -363,14 +360,12 @@ public class MemoryHandlerTest extends TestCase { } - @TestInfo - (level = TestLevel.COMPLETE, - purpose = "", - targets = - { - @TestTarget(methodName = "MemoryHandler", methodArgs = {}) - } - ) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "MemoryHandler", + args = {} + ) public void testMemoryHandlerDefaultValue() throws SecurityException, IOException { props.clear(); @@ -391,14 +386,12 @@ public class MemoryHandlerTest extends TestCase { /* * Class under test for void MemoryHandler(Handler, int, Level) */ - @TestInfo - (level = TestLevel.COMPLETE, - purpose = "", - targets = - { - @TestTarget(methodName = "MemoryHandler", methodArgs = {Handler.class, int.class, Level.class}) - } - ) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "MemoryHandler", + args = {java.util.logging.Handler.class, int.class, java.util.logging.Level.class} + ) public void testMemoryHandlerHandlerintLevel() { handler = new MemoryHandler(target, 2, Level.FINEST); assertNotNull("Filter should not be null", handler.getFilter()); @@ -433,14 +426,12 @@ public class MemoryHandlerTest extends TestCase { } - @TestInfo - (level = TestLevel.COMPLETE, - purpose = "", - targets = - { - @TestTarget(methodName = "getPushLevel", methodArgs = {}) - } - ) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getPushLevel", + args = {} + ) public void testGetPushLevel() { try { handler.setPushLevel(null); @@ -451,14 +442,12 @@ public class MemoryHandlerTest extends TestCase { assertEquals(handler.getPushLevel(), Level.parse("123")); } - @TestInfo - (level = TestLevel.COMPLETE, - purpose = "", - targets = - { - @TestTarget(methodName = "setPushLevel", methodArgs = {Level.class}) - } - ) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setPushLevel", + args = {java.util.logging.Level.class} + ) public void testSetPushLevel() { // change push level don't trigger push action writer.getBuffer().setLength(0); @@ -473,14 +462,12 @@ public class MemoryHandlerTest extends TestCase { assertEquals(writer.toString(), lr.getMessage() + lr.getMessage()); } - @TestInfo - (level = TestLevel.COMPLETE, - purpose = "", - targets = - { - @TestTarget(methodName = "push", methodArgs = {}) - } - ) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "push", + args = {} + ) public void testPushPublic() { writer.getBuffer().setLength(0); // loggable but don't trig push diff --git a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/MessagesTest.java b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/MessagesTest.java index ff6c0ce..74edbcb 100644 --- a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/MessagesTest.java +++ b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/MessagesTest.java @@ -26,9 +26,10 @@ import java.io.OutputStream; import java.io.PrintStream; import java.util.logging.ErrorManager; -import dalvik.annotation.TestInfo; +import dalvik.annotation.AndroidOnly; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; @@ -50,85 +51,71 @@ public class MessagesTest extends TestCase{ } - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "Just check signature, cannot make use of mock, " + - "method depend on luni", - targets = { - @TestTarget( - methodName = "getString", - methodArgs = {java.lang.String.class} - ) - }) - public void testGetString_String() { - m.getString(new String()); - } + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "Just check signature, cannot make use of mock, method depend on luni", + method = "getString", + args = {java.lang.String.class} + ) + @AndroidOnly("harmony specific") + public void testGetString_String() { + m.getString(new String()); + } - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "Juste check signature, cannot make use of mock, depend on luni", - targets = { - @TestTarget( - methodName = "getString", - methodArgs = {java.lang.String.class, Object.class} - ) - }) - public void testGetString_StringObject() { - m.getString(new String(),new Object()); - - } + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "Juste check signature, cannot make use of mock, depend on luni", + method = "getString", + args = {java.lang.String.class, java.lang.Object.class} + ) + @AndroidOnly("harmony specific") + public void testGetString_StringObject() { + m.getString(new String(), new Object()); + } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Juste check signature, cannot make use of mock, depend on luni", - targets = { - @TestTarget( - methodName = "getString", - methodArgs = {java.lang.String.class, int.class} - ) - }) - public void testGetString_StringInt() { - m.getString(new String(),0); - } + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Juste check signature, cannot make use of mock, depend on luni", + method = "getString", + args = {java.lang.String.class, int.class} + ) + @AndroidOnly("harmony specific") + public void testGetString_StringInt() { + m.getString(new String(), 0); + } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Juste check signature, cannot make use of mock, depend on luni", - targets = { - @TestTarget( - methodName = "getString", - methodArgs = {java.lang.String.class, char.class} - ) - }) - public void testGetString_StringChar() { - m.getString(new String(), 'a'); - } - - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Juste check signature, cannot make use of mock, depend on luni", - targets = { - @TestTarget( - methodName = "getString", - methodArgs = {java.lang.String.class, Object.class, Object.class} - ) - }) - public void testGetString_StringObjectObject() { - m.getString(new String(), new Object(), new Object() ); - } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Juste check signature, cannot make use of mock, depend on luni", - targets = { - @TestTarget( - methodName = "getString", - methodArgs = {java.lang.String.class, Object[].class} - ) - }) - public void testGetString_StringObjectArray() { - m.getString(new String(), new Object[1]); - } + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Juste check signature, cannot make use of mock, depend on luni", + method = "getString", + args = {java.lang.String.class, char.class} + ) + @AndroidOnly("harmony specific") + public void testGetString_StringChar() { + m.getString(new String(), 'a'); + } + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Juste check signature, cannot make use of mock, depend on luni", + method = "getString", + args = {java.lang.String.class, java.lang.Object.class, java.lang.Object.class} + ) + @AndroidOnly("harmony specific") + public void testGetString_StringObjectObject() { + m.getString(new String(), new Object(), new Object() ); + } + + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Juste check signature, cannot make use of mock, depend on luni", + method = "getString", + args = {java.lang.String.class, java.lang.Object[].class} + ) + @AndroidOnly("harmony specific") + public void testGetString_StringObjectArray() { + m.getString(new String(), new Object[1]); + } } diff --git a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/SimpleFormatterTest.java b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/SimpleFormatterTest.java index bc9990c..79e37e8 100644 --- a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/SimpleFormatterTest.java +++ b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/SimpleFormatterTest.java @@ -17,9 +17,9 @@ package org.apache.harmony.logging.tests.java.util.logging; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import java.util.Calendar; @@ -56,30 +56,38 @@ public class SimpleFormatterTest extends TestCase { /* * test for constructor protected SimpleFormatter */ - @TestInfo - (level = TestLevel.COMPLETE, - purpose = "", - targets = - { - @TestTarget(methodName = "SimpleFormatter", methodArgs = {}), - @TestTarget(methodName = "getHead", methodArgs = {Handler.class}), - @TestTarget(methodName = "getTail", methodArgs = {Handler.class}) - } - ) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "SimpleFormatter", + args = {} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getHead", + args = {java.util.logging.Handler.class} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getTail", + args = {java.util.logging.Handler.class} + ) + }) public void testSimpleFormatter() { assertEquals("Head for this SimpleFormatter should be empty", "", sf .getHead(null)); assertEquals("Tail for this SimpleFormatter should be empty", "", sf .getTail(null)); } - @TestInfo - (level = TestLevel.COMPLETE, - purpose = "", - targets = - { - @TestTarget(methodName = "format", methodArgs = {LogRecord.class}) - } - ) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "format", + args = {java.util.logging.LogRecord.class} + ) public void testFormatNull() { try { sf.format(null); @@ -89,14 +97,12 @@ public class SimpleFormatterTest extends TestCase { sf.format(new LogRecord(Level.SEVERE, null)); } - @TestInfo - (level = TestLevel.COMPLETE, - purpose = "", - targets = - { - @TestTarget(methodName = "format", methodArgs = {LogRecord.class}) - } - ) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "format", + args = {java.util.logging.LogRecord.class} + ) public void testLocalizedFormat() { // if bundle set, should use localized message ResourceBundle rb = ResourceBundle @@ -116,14 +122,12 @@ public class SimpleFormatterTest extends TestCase { assertTrue(str.indexOf(localeMsg) < 0); } - @TestInfo - (level = TestLevel.COMPLETE, - purpose = "", - targets = - { - @TestTarget(methodName = "format", methodArgs = {LogRecord.class}) - } - ) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "format", + args = {java.util.logging.LogRecord.class} + ) public void testFormat() { String str = sf.format(lr); Throwable t; @@ -155,26 +159,22 @@ public class SimpleFormatterTest extends TestCase { assertTrue(str.indexOf(Level.FINE.getLocalizedName()) > 0); } - @TestInfo - (level = TestLevel.COMPLETE, - purpose = "", - targets = - { - @TestTarget(methodName = "getHead", methodArgs = {Handler.class}) - } - ) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getHead", + args = {java.util.logging.Handler.class} + ) public void testGetHead() { assertEquals("", sf.getHead(null)); } - @TestInfo - (level = TestLevel.COMPLETE, - purpose = "", - targets = - { - @TestTarget(methodName = "getTail", methodArgs = {Handler.class}) - } - ) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getTail", + args = {java.util.logging.Handler.class} + ) public void testGetTail() { assertEquals("", sf.getTail(null)); } diff --git a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/SocketHandlerTest.java b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/SocketHandlerTest.java index 6d5f280..3e17ff6 100644 --- a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/SocketHandlerTest.java +++ b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/SocketHandlerTest.java @@ -17,9 +17,9 @@ package org.apache.harmony.logging.tests.java.util.logging; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import java.io.ByteArrayOutputStream; @@ -116,18 +116,18 @@ public class SocketHandlerTest extends TestCase { /* * Test the constructor with no relevant log manager properties are set. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies the constructor with no relevant log manager " + - "properties are set.", - targets = { - @TestTarget( - methodName = "SocketHandler", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies the constructor with no relevant log manager properties are set.", + method = "SocketHandler", + args = {} ), - @TestTarget( - methodName = "SocketHandler", - methodArgs = {java.lang.String.class, int.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies the constructor with no relevant log manager properties are set.", + method = "SocketHandler", + args = {java.lang.String.class, int.class} ) }) public void testConstructor_NoProperties() throws Exception { @@ -205,18 +205,18 @@ public class SocketHandlerTest extends TestCase { * Test the constructor with no relevant log manager properties are set * except host and port. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies the constructor with no relevant log manager " + - "properties are set except host and port.", - targets = { - @TestTarget( - methodName = "SocketHandler", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies the constructor with no relevant log manager properties are set except host and port.", + method = "SocketHandler", + args = {} ), - @TestTarget( - methodName = "SocketHandler", - methodArgs = {java.lang.String.class, int.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies the constructor with no relevant log manager properties are set except host and port.", + method = "SocketHandler", + args = {java.lang.String.class, int.class} ) }) public void testConstructor_NoBasicProperties() throws Exception { @@ -258,17 +258,18 @@ public class SocketHandlerTest extends TestCase { /* * Test the constructor with insufficient privilege for connection. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies SecurityException.", - targets = { - @TestTarget( - methodName = "SocketHandler", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies SecurityException.", + method = "SocketHandler", + args = {} ), - @TestTarget( - methodName = "SocketHandler", - methodArgs = {java.lang.String.class, int.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies SecurityException.", + method = "SocketHandler", + args = {java.lang.String.class, int.class} ) }) public void testConstructor_InsufficientPrivilege() throws Exception { @@ -307,18 +308,18 @@ public class SocketHandlerTest extends TestCase { /* * Test the constructor with valid relevant log manager properties are set. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies the constructor with valid relevant log manager " + - "properties are set.", - targets = { - @TestTarget( - methodName = "SocketHandler", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies the constructor with valid relevant log manager properties are set.", + method = "SocketHandler", + args = {} ), - @TestTarget( - methodName = "SocketHandler", - methodArgs = {java.lang.String.class, int.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies the constructor with valid relevant log manager properties are set.", + method = "SocketHandler", + args = {java.lang.String.class, int.class} ) }) public void testConstructor_ValidProperties() throws Exception { @@ -367,18 +368,18 @@ public class SocketHandlerTest extends TestCase { * Test the constructor with invalid relevant log manager properties are set * except host and port. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies the constructor with invalid relevant log manager " + - "properties are set except host and port.", - targets = { - @TestTarget( - methodName = "SocketHandler", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies the constructor with invalid relevant log manager properties are set except host and port.", + method = "SocketHandler", + args = {} ), - @TestTarget( - methodName = "SocketHandler", - methodArgs = {java.lang.String.class, int.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies the constructor with invalid relevant log manager properties are set except host and port.", + method = "SocketHandler", + args = {java.lang.String.class, int.class} ) }) public void testConstructor_InvalidBasicProperties() throws Exception { @@ -429,15 +430,12 @@ public class SocketHandlerTest extends TestCase { * Test the constructor with valid relevant log manager properties are set * except port. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies IllegalArgumentException.", - targets = { - @TestTarget( - methodName = "SocketHandler", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies IllegalArgumentException.", + method = "SocketHandler", + args = {} + ) public void testConstructor_InvalidPort() throws Exception { Properties p = new Properties(); p.put("java.util.logging.SocketHandler.level", "FINE"); @@ -463,18 +461,18 @@ public class SocketHandlerTest extends TestCase { * Test the constructor with valid relevant log manager properties are set, * but the port is not open. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that the constructor with valid relevant log manager " + - "properties are set, but the port is not open.", - targets = { - @TestTarget( - methodName = "SocketHandler", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that the constructor with valid relevant log manager properties are set, but the port is not open.", + method = "SocketHandler", + args = {} ), - @TestTarget( - methodName = "SocketHandler", - methodArgs = {java.lang.String.class, int.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that the constructor with valid relevant log manager properties are set, but the port is not open.", + method = "SocketHandler", + args = {java.lang.String.class, int.class} ) }) public void testConstructor_NotOpenPort() throws Exception { @@ -509,17 +507,18 @@ public class SocketHandlerTest extends TestCase { * Test the constructor with valid relevant log manager properties are set * except port. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies IOException.", - targets = { - @TestTarget( - methodName = "SocketHandler", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies IOException.", + method = "SocketHandler", + args = {} ), - @TestTarget( - methodName = "SocketHandler", - methodArgs = {java.lang.String.class, int.class} + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies IOException.", + method = "SocketHandler", + args = {java.lang.String.class, int.class} ) }) public void testConstructor_InvalidHost() throws Exception { @@ -554,16 +553,12 @@ public class SocketHandlerTest extends TestCase { * Test close() when having sufficient privilege, and a record has been * written to the output stream. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies close() when having sufficient privilege, " + - "and a record has been written to the output stream.", - targets = { - @TestTarget( - methodName = "close", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies close() when having sufficient privilege, and a record has been written to the output stream.", + method = "close", + args = {} + ) public void testClose_SufficientPrivilege_NormalClose() throws Exception { Properties p = new Properties(); p.put("java.util.logging.SocketHandler.formatter", className @@ -592,15 +587,12 @@ public class SocketHandlerTest extends TestCase { * Test close() when having sufficient privilege, and no record has been * written to the output stream. */ - @TestInfo - (level = TestLevel.PARTIAL_OK, - purpose = "Verifies close() when having sufficient privilege, " + - "and no record has been written to the output stream.", - targets = - { - @TestTarget(methodName = "close", methodArgs = {}) - } - ) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies close() when having sufficient privilege, and no record has been written to the output stream.", + method = "close", + args = {} + ) public void testClose_SufficientPrivilege_DirectClose() throws Exception { Properties p = new Properties(); p.put("java.util.logging.SocketHandler.formatter", className @@ -626,14 +618,12 @@ public class SocketHandlerTest extends TestCase { /* * Test close() when having insufficient privilege. */ - @TestInfo - (level = TestLevel.PARTIAL_OK, - purpose = "Verifies close() when having insufficient privilege.", - targets = - { - @TestTarget(methodName = "close", methodArgs = {}) - } - ) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies close() when having insufficient privilege.", + method = "close", + args = {} + ) public void testClose_InsufficientPrivilege() throws Exception { Properties p = new Properties(); p.put("java.util.logging.SocketHandler.formatter", className @@ -668,16 +658,12 @@ public class SocketHandlerTest extends TestCase { /* * Test publish(), use no filter, having output stream, normal log record. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies publish(), use no filter, having output stream, " + - "normal log record.", - targets = { - @TestTarget( - methodName = "publish", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies publish(), use no filter, having output stream, normal log record.", + method = "publish", + args = {java.util.logging.LogRecord.class} + ) public void testPublish_NoFilter() throws Exception { Properties p = new Properties(); p.put("java.util.logging.SocketHandler.formatter", className @@ -717,16 +703,12 @@ public class SocketHandlerTest extends TestCase { /* * Test publish(), use a filter, having output stream, normal log record. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies publish(), use a filter, having output stream, " + - "normal log record.", - targets = { - @TestTarget( - methodName = "publish", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies publish(), use a filter, having output stream, normal log record.", + method = "publish", + args = {java.util.logging.LogRecord.class} + ) public void testPublish_WithFilter() throws Exception { Properties p = new Properties(); p.put("java.util.logging.SocketHandler.formatter", className @@ -757,15 +739,12 @@ public class SocketHandlerTest extends TestCase { /* * Test publish(), null log record, having output stream */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies publish(), null log record, having output stream.", - targets = { - @TestTarget( - methodName = "publish", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies publish(), null log record, having output stream.", + method = "publish", + args = {java.util.logging.LogRecord.class} + ) public void testPublish_Null() throws Exception { Properties p = new Properties(); p.put("java.util.logging.SocketHandler.formatter", className @@ -793,16 +772,12 @@ public class SocketHandlerTest extends TestCase { /* * Test publish(), a log record with empty msg, having output stream */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies publish() method, a log record with empty msg, " + - "having output stream.", - targets = { - @TestTarget( - methodName = "publish", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies publish() method, a log record with empty msg, having output stream.", + method = "publish", + args = {java.util.logging.LogRecord.class} + ) public void testPublish_EmptyMsg() throws Exception { Properties p = new Properties(); p.put("java.util.logging.SocketHandler.formatter", className @@ -828,16 +803,12 @@ public class SocketHandlerTest extends TestCase { /* * Test publish(), a log record with null msg, having output stream */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies publish(), a log record with null msg, " + - "having output stream.", - targets = { - @TestTarget( - methodName = "publish", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies publish(), a log record with null msg, having output stream.", + method = "publish", + args = {java.util.logging.LogRecord.class} + ) public void testPublish_NullMsg() throws Exception { Properties p = new Properties(); p.put("java.util.logging.SocketHandler.formatter", className @@ -863,15 +834,12 @@ public class SocketHandlerTest extends TestCase { /* * Test publish(), after close. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies publish() method after close.", - targets = { - @TestTarget( - methodName = "publish", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies publish() method after close.", + method = "publish", + args = {java.util.logging.LogRecord.class} + ) public void testPublish_AfterClose() throws Exception { Properties p = new Properties(); p.put("java.util.logging.SocketHandler.formatter", className diff --git a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/StreamHandlerTest.java b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/StreamHandlerTest.java index 6149f06..72270e5 100644 --- a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/StreamHandlerTest.java +++ b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/StreamHandlerTest.java @@ -93,16 +93,12 @@ public class StreamHandlerTest extends TestCase { * Test the constructor with no parameter, and no relevant log manager * properties are set. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies the constructor with no parameter, " + - "and no relevant log manager properties are set.", - targets = { - @TestTarget( - methodName = "StreamHandler", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies the constructor with no parameter, and no relevant log manager properties are set.", + method = "StreamHandler", + args = {} + ) public void testConstructor_NoParameter_NoProperties() { assertNull(LogManager.getLogManager().getProperty( "java.util.logging.StreamHandler.level")); @@ -123,15 +119,12 @@ public class StreamHandlerTest extends TestCase { /* * Test the constructor with insufficient privilege. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies the constructor with insufficient privilege.", - targets = { - @TestTarget( - methodName = "StreamHandler", - methodArgs = {java.io.OutputStream.class, java.util.logging.Formatter.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies the constructor with insufficient privilege.", + method = "StreamHandler", + args = {java.io.OutputStream.class, java.util.logging.Formatter.class} + ) public void testConstructor_NoParameter_InsufficientPrivilege() { assertNull(LogManager.getLogManager().getProperty( "java.util.logging.StreamHandler.level")); @@ -160,16 +153,12 @@ public class StreamHandlerTest extends TestCase { * Test the constructor with no parameter, and valid relevant log manager * properties are set. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies the constructor with no parameter, and valid " + - "relevant log manager properties are set.", - targets = { - @TestTarget( - methodName = "StreamHandler", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies the constructor with no parameter, and valid relevant log manager properties are set.", + method = "StreamHandler", + args = {} + ) public void testConstructor_NoParameter_ValidProperties() throws Exception { Properties p = new Properties(); p.put("java.util.logging.StreamHandler.level", "FINE"); @@ -196,16 +185,12 @@ public class StreamHandlerTest extends TestCase { * Test the constructor with no parameter, and invalid relevant log manager * properties are set. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies the constructor with no parameter, and invalid " + - "relevant log manager properties are set.", - targets = { - @TestTarget( - methodName = "StreamHandler", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies the constructor with no parameter, and invalid relevant log manager properties are set.", + method = "StreamHandler", + args = {} + ) public void testConstructor_NoParameter_InvalidProperties() throws Exception { Properties p = new Properties(); @@ -234,17 +219,12 @@ public class StreamHandlerTest extends TestCase { * Test the constructor with normal parameter values, and no relevant log * manager properties are set. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies the constructor with normal parameter values, " + - "and no relevant log manager properties are set.", - targets = { - @TestTarget( - methodName = "StreamHandler", - methodArgs = {java.io.OutputStream.class, - java.util.logging.Formatter.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies the constructor with normal parameter values, and no relevant log manager properties are set.", + method = "StreamHandler", + args = {java.io.OutputStream.class, java.util.logging.Formatter.class} + ) public void testConstructor_HasParameters_NoProperties() { assertNull(LogManager.getLogManager().getProperty( "java.util.logging.StreamHandler.level")); @@ -266,16 +246,12 @@ public class StreamHandlerTest extends TestCase { /* * Test the constructor with insufficient privilege. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies the constructor with insufficient privilege.", - targets = { - @TestTarget( - methodName = "StreamHandler", - methodArgs = {java.io.OutputStream.class, - java.util.logging.Formatter.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies the constructor with insufficient privilege.", + method = "StreamHandler", + args = {java.io.OutputStream.class, java.util.logging.Formatter.class} + ) public void testConstructor_HasParameter_InsufficientPrivilege() { assertNull(LogManager.getLogManager().getProperty( "java.util.logging.StreamHandler.level")); @@ -305,16 +281,12 @@ public class StreamHandlerTest extends TestCase { * Test the constructor with normal parameter values, and valid relevant log * manager properties are set. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies the constructor with normal parameter values, " + - "and valid relevant log manager properties are set.", - targets = { - @TestTarget( - methodName = "StreamHandler", - methodArgs = {java.io.OutputStream.class, java.util.logging.Formatter.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies the constructor with normal parameter values, and valid relevant log manager properties are set.", + method = "StreamHandler", + args = {java.io.OutputStream.class, java.util.logging.Formatter.class} + ) public void testConstructor_HasParameters_ValidProperties() throws Exception { Properties p = new Properties(); @@ -343,16 +315,12 @@ public class StreamHandlerTest extends TestCase { * Test the constructor with normal parameter, and invalid relevant log * manager properties are set. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies the constructor with normal parameter, " + - "and invalid relevant log manager properties are set.", - targets = { - @TestTarget( - methodName = "StreamHandler", - methodArgs = {java.io.OutputStream.class, java.util.logging.Formatter.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies the constructor with normal parameter, and invalid relevant log manager properties are set.", + method = "StreamHandler", + args = {java.io.OutputStream.class, java.util.logging.Formatter.class} + ) public void testConstructor_HasParameters_InvalidProperties() throws Exception { Properties p = new Properties(); @@ -379,16 +347,12 @@ public class StreamHandlerTest extends TestCase { * Test the constructor with null formatter, and invalid relevant log manager * properties are set. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies the constructor with null formatter, " + - "and invalid relevant log manager properties are set.", - targets = { - @TestTarget( - methodName = "StreamHandler", - methodArgs = {java.io.OutputStream.class, java.util.logging.Formatter.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies the constructor with null formatter, and invalid relevant log manager properties are set.", + method = "StreamHandler", + args = {java.io.OutputStream.class, java.util.logging.Formatter.class} + ) public void testConstructor_HasParameters_ValidPropertiesNullStream() throws Exception { Properties p = new Properties(); @@ -417,16 +381,12 @@ public class StreamHandlerTest extends TestCase { * Test the constructor with null output stream, and invalid relevant log * manager properties are set. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies the constructor with null output stream, " + - "and invalid relevant log manager properties are set.", - targets = { - @TestTarget( - methodName = "StreamHandler", - methodArgs = {java.io.OutputStream.class, java.util.logging.Formatter.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies the constructor with null output stream, and invalid relevant log manager properties are set.", + method = "StreamHandler", + args = {java.io.OutputStream.class, java.util.logging.Formatter.class} + ) public void testConstructor_HasParameters_ValidPropertiesNullFormatter() throws Exception { Properties p = new Properties(); @@ -455,16 +415,12 @@ public class StreamHandlerTest extends TestCase { * Test close() when having sufficient privilege, and a record has been * written to the output stream. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies close() when having sufficient privilege, " + - "and a record has been written to the output stream.", - targets = { - @TestTarget( - methodName = "close", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies close() when having sufficient privilege, and a record has been written to the output stream.", + method = "close", + args = {} + ) public void testClose_SufficientPrivilege_NormalClose() { ByteArrayOutputStream aos = new MockOutputStream(); StreamHandler h = new StreamHandler(aos, new MockFormatter()); @@ -485,15 +441,12 @@ public class StreamHandlerTest extends TestCase { * Test close() when having sufficient privilege, and an output stream that * always throws exceptions. */ - @TestInfo - (level = TestLevel.PARTIAL_OK, - purpose = "Verifies close() when having sufficient privilege, " + - "and an output stream that always throws exceptions.", - targets = {@TestTarget( - methodName = "close", - methodArgs = {}) - } - ) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies close() when having sufficient privilege, and an output stream that always throws exceptions.", + method = "close", + args = {} + ) public void testClose_SufficientPrivilege_Exception() { ByteArrayOutputStream aos = new MockExceptionOutputStream(); StreamHandler h = new StreamHandler(aos, new MockFormatter()); @@ -507,15 +460,12 @@ public class StreamHandlerTest extends TestCase { * Test close() when having sufficient privilege, and no record has been * written to the output stream. */ - @TestInfo - (level = TestLevel.PARTIAL_OK, - purpose = "Verifies close() method when having sufficient privilege, " + - "and no record has been written to the output stream.", - targets = - { - @TestTarget(methodName = "close", methodArgs = {}) - } - ) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies close() method when having sufficient privilege, and no record has been written to the output stream.", + method = "close", + args = {} + ) public void testClose_SufficientPrivilege_DirectClose() { ByteArrayOutputStream aos = new MockOutputStream(); StreamHandler h = new StreamHandler(aos, new MockFormatter()); @@ -532,14 +482,12 @@ public class StreamHandlerTest extends TestCase { /* * Test close() when having insufficient privilege. */ - @TestInfo - (level = TestLevel.PARTIAL_OK, - purpose = "Verifies SecurityException.", - targets = - { - @TestTarget(methodName = "close", methodArgs = {}) - } - ) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies SecurityException.", + method = "close", + args = {} + ) public void testClose_InsufficientPrivilege() { StreamHandler h = new StreamHandler(new ByteArrayOutputStream(), new MockFormatter()); @@ -559,14 +507,12 @@ public class StreamHandlerTest extends TestCase { /* * Test close() when having no output stream. */ - @TestInfo - (level = TestLevel.PARTIAL_OK, - purpose = "Verifies close() method when having no output stream.", - targets = - { - @TestTarget(methodName = "close", methodArgs = {}) - } - ) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies close() method when having no output stream.", + method = "close", + args = {} + ) public void testClose_NoOutputStream() { StreamHandler h = new StreamHandler(); h.close(); @@ -575,15 +521,12 @@ public class StreamHandlerTest extends TestCase { /* * Test flush(). */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies flush() method.", - targets = { - @TestTarget( - methodName = "flush", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies flush() method.", + method = "flush", + args = {} + ) public void testFlush_Normal() { ByteArrayOutputStream aos = new MockOutputStream(); StreamHandler h = new StreamHandler(aos, new MockFormatter()); @@ -596,15 +539,12 @@ public class StreamHandlerTest extends TestCase { /* * Test flush() when having no output stream. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies flush() when having no output stream.", - targets = { - @TestTarget( - methodName = "flush", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies flush() when having no output stream.", + method = "flush", + args = {} + ) public void testFlush_NoOutputStream() { StreamHandler h = new StreamHandler(); h.flush(); @@ -613,15 +553,12 @@ public class StreamHandlerTest extends TestCase { /* * Test isLoggable(), use no filter, having no output stream */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies isLoggable(), use no filter, having no output stream.", - targets = { - @TestTarget( - methodName = "isLoggable", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies isLoggable(), use no filter, having no output stream.", + method = "isLoggable", + args = {java.util.logging.LogRecord.class} + ) public void testIsLoggable_NoOutputStream() { StreamHandler h = new StreamHandler(); LogRecord r = new LogRecord(Level.INFO, null); @@ -641,15 +578,12 @@ public class StreamHandlerTest extends TestCase { /* * Test isLoggable(), use no filter, having output stream */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies isLoggable(), use no filter, having output stream.", - targets = { - @TestTarget( - methodName = "isLoggable", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies isLoggable(), use no filter, having output stream.", + method = "isLoggable", + args = {java.util.logging.LogRecord.class} + ) public void testIsLoggable_NoFilter() { StreamHandler h = new StreamHandler(new ByteArrayOutputStream(), new SimpleFormatter()); @@ -670,15 +604,12 @@ public class StreamHandlerTest extends TestCase { /* * Test isLoggable(), use a filter, having output stream */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies isLoggable(), use a filter, having output stream.", - targets = { - @TestTarget( - methodName = "isLoggable", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies isLoggable(), use a filter, having output stream.", + method = "isLoggable", + args = {java.util.logging.LogRecord.class} + ) public void testIsLoggable_WithFilter() { StreamHandler h = new StreamHandler(new ByteArrayOutputStream(), new SimpleFormatter()); @@ -700,16 +631,12 @@ public class StreamHandlerTest extends TestCase { * Test isLoggable(), null log record, having output stream. Handler should * call ErrorManager to handle exceptional case */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies isLoggable(), null log record, having output stream. " + - "Handler should call ErrorManager to handle exceptional case.", - targets = { - @TestTarget( - methodName = "isLoggable", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies isLoggable(), null log record, having output stream. Handler should call ErrorManager to handle exceptional case.", + method = "isLoggable", + args = {java.util.logging.LogRecord.class} + ) public void testIsLoggable_Null() { StreamHandler h = new StreamHandler(new ByteArrayOutputStream(), new SimpleFormatter()); @@ -719,15 +646,12 @@ public class StreamHandlerTest extends TestCase { /* * Test isLoggable(), null log record, without output stream */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies isLoggable(), null log record, without output stream.", - targets = { - @TestTarget( - methodName = "isLoggable", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies isLoggable(), null log record, without output stream.", + method = "isLoggable", + args = {java.util.logging.LogRecord.class} + ) public void testIsLoggable_Null_NoOutputStream() { StreamHandler h = new StreamHandler(); assertFalse(h.isLoggable(null)); @@ -736,16 +660,12 @@ public class StreamHandlerTest extends TestCase { /* * Test publish(), use no filter, having output stream, normal log record. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies publish(), use no filter, having output stream, " + - "normal log record.", - targets = { - @TestTarget( - methodName = "publish", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies publish(), use no filter, having output stream, normal log record.", + method = "publish", + args = {java.util.logging.LogRecord.class} + ) public void testPublish_NoOutputStream() { StreamHandler h = new StreamHandler(); LogRecord r = new LogRecord(Level.INFO, "testPublish_NoOutputStream"); @@ -765,16 +685,12 @@ public class StreamHandlerTest extends TestCase { /* * Test publish(), use no filter, having output stream, normal log record. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies publish(), use no filter, having output stream, " + - "normal log record.", - targets = { - @TestTarget( - methodName = "publish", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies publish(), use no filter, having output stream, normal log record.", + method = "publish", + args = {java.util.logging.LogRecord.class} + ) public void testPublish_NoFilter() { ByteArrayOutputStream aos = new ByteArrayOutputStream(); StreamHandler h = new StreamHandler(aos, new MockFormatter()); @@ -809,16 +725,12 @@ public class StreamHandlerTest extends TestCase { /* * Test publish(), use a filter, having output stream, normal log record. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies publish(), use a filter, having output stream, " + - "normal log record.", - targets = { - @TestTarget( - methodName = "publish", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies publish(), use a filter, having output stream, normal log record.", + method = "publish", + args = {java.util.logging.LogRecord.class} + ) public void testPublish_WithFilter() { ByteArrayOutputStream aos = new ByteArrayOutputStream(); StreamHandler h = new StreamHandler(aos, new MockFormatter()); @@ -855,16 +767,12 @@ public class StreamHandlerTest extends TestCase { * Test publish(), null log record, handler should call ErrorManager to * handle exceptional case */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies publish(), null log record, handler should call " + - "ErrorManager to handle exceptional case.", - targets = { - @TestTarget( - methodName = "publish", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies publish(), null log record, handler should call ErrorManager to handle exceptional case.", + method = "publish", + args = {java.util.logging.LogRecord.class} + ) public void testPublish_Null() { StreamHandler h = new StreamHandler(new ByteArrayOutputStream(), new SimpleFormatter()); @@ -874,15 +782,12 @@ public class StreamHandlerTest extends TestCase { /* * Test publish(), null log record, without output stream */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies publish(), null log record, without output stream.", - targets = { - @TestTarget( - methodName = "publish", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies publish(), null log record, without output stream.", + method = "publish", + args = {java.util.logging.LogRecord.class} + ) public void testPublish_Null_NoOutputStream() { StreamHandler h = new StreamHandler(); h.publish(null); @@ -900,16 +805,12 @@ public class StreamHandlerTest extends TestCase { /* * Test publish(), a log record with empty msg, having output stream */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies publish(), a log record with empty msg, " + - "having output stream.", - targets = { - @TestTarget( - methodName = "publish", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies publish(), a log record with empty msg, having output stream.", + method = "publish", + args = {java.util.logging.LogRecord.class} + ) public void testPublish_EmptyMsg() { ByteArrayOutputStream aos = new ByteArrayOutputStream(); StreamHandler h = new StreamHandler(aos, new MockFormatter()); @@ -922,16 +823,12 @@ public class StreamHandlerTest extends TestCase { /* * Test publish(), a log record with null msg, having output stream */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies publish(), a log record with null msg, " + - "having output stream.", - targets = { - @TestTarget( - methodName = "publish", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies publish(), a log record with null msg, having output stream.", + method = "publish", + args = {java.util.logging.LogRecord.class} + ) public void testPublish_NullMsg() { ByteArrayOutputStream aos = new ByteArrayOutputStream(); StreamHandler h = new StreamHandler(aos, new MockFormatter()); @@ -944,15 +841,12 @@ public class StreamHandlerTest extends TestCase { /* * Test publish(), after close. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies publish(), after close.", - targets = { - @TestTarget( - methodName = "publish", - methodArgs = {java.util.logging.LogRecord.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies publish(), after close.", + method = "publish", + args = {java.util.logging.LogRecord.class} + ) public void testPublish_AfterClose() throws Exception { Properties p = new Properties(); p.put("java.util.logging.StreamHandler.level", "FINE"); @@ -974,15 +868,12 @@ public class StreamHandlerTest extends TestCase { /* * Test setEncoding() method with supported encoding. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies setEncoding() method with supported encoding.", - targets = { - @TestTarget( - methodName = "setEncoding", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies setEncoding() method with supported encoding.", + method = "setEncoding", + args = {java.lang.String.class} + ) public void testSetEncoding_Normal() throws Exception { ByteArrayOutputStream aos = new ByteArrayOutputStream(); StreamHandler h = new StreamHandler(aos, new MockFormatter()); @@ -1002,16 +893,12 @@ public class StreamHandlerTest extends TestCase { * Test setEncoding() method with supported encoding, after a log record * has been written. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies setEncoding() method with supported encoding, " + - "after a log record has been written.", - targets = { - @TestTarget( - methodName = "setEncoding", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies setEncoding() method with supported encoding, after a log record has been written.", + method = "setEncoding", + args = {java.lang.String.class} + ) public void testSetEncoding_AfterPublish() throws Exception { ByteArrayOutputStream aos = new ByteArrayOutputStream(); StreamHandler h = new StreamHandler(aos, new MockFormatter()); @@ -1047,15 +934,12 @@ public class StreamHandlerTest extends TestCase { /* * Test setEncoding() methods with null. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies setEncoding() methods with null.", - targets = { - @TestTarget( - methodName = "setEncoding", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies setEncoding() methods with null.", + method = "setEncoding", + args = {java.lang.String.class} + ) public void testSetEncoding_Null() throws Exception { StreamHandler h = new StreamHandler(); h.setEncoding(null); @@ -1065,15 +949,12 @@ public class StreamHandlerTest extends TestCase { /* * Test setEncoding() methods with unsupported encoding. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies setEncoding() methods with unsupported encoding.", - targets = { - @TestTarget( - methodName = "setEncoding", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies setEncoding() methods with unsupported encoding.", + method = "setEncoding", + args = {java.lang.String.class} + ) public void testSetEncoding_Unsupported() { StreamHandler h = new StreamHandler(); try { @@ -1088,15 +969,12 @@ public class StreamHandlerTest extends TestCase { /* * Test setEncoding() with insufficient privilege. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies setEncoding() method with insufficient privilege.", - targets = { - @TestTarget( - methodName = "setEncoding", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies setEncoding() method with insufficient privilege.", + method = "setEncoding", + args = {java.lang.String.class} + ) public void testSetEncoding_InsufficientPrivilege() throws Exception { StreamHandler h = new StreamHandler(); SecurityManager oldMan = System.getSecurityManager(); @@ -1128,16 +1006,12 @@ public class StreamHandlerTest extends TestCase { /* * Test setEncoding() methods will flush a stream before setting. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that setEncoding() method will flush a stream " + - "before setting.", - targets = { - @TestTarget( - methodName = "setEncoding", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that setEncoding() method will flush a stream before setting.", + method = "setEncoding", + args = {java.lang.String.class} + ) public void testSetEncoding_FlushBeforeSetting() throws Exception { ByteArrayOutputStream aos = new ByteArrayOutputStream(); StreamHandler h = new StreamHandler(aos, new MockFormatter()); @@ -1151,15 +1025,12 @@ public class StreamHandlerTest extends TestCase { /* * Test setOutputStream() with null. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies setOutputStream() method with null.", - targets = { - @TestTarget( - methodName = "setOutputStream", - methodArgs = {java.io.OutputStream.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies setOutputStream() method with null.", + method = "setOutputStream", + args = {java.io.OutputStream.class} + ) public void testSetOutputStream_null() { MockStreamHandler h = new MockStreamHandler( new ByteArrayOutputStream(), new SimpleFormatter()); @@ -1174,15 +1045,12 @@ public class StreamHandlerTest extends TestCase { /* * Test setOutputStream() under normal condition. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies setOutputStream() method under normal condition.", - targets = { - @TestTarget( - methodName = "setOutputStream", - methodArgs = {java.io.OutputStream.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies setOutputStream() method under normal condition.", + method = "setOutputStream", + args = {java.io.OutputStream.class} + ) public void testSetOutputStream_Normal() { ByteArrayOutputStream aos = new ByteArrayOutputStream(); MockStreamHandler h = new MockStreamHandler(aos, new MockFormatter()); @@ -1213,15 +1081,12 @@ public class StreamHandlerTest extends TestCase { /* * Test setOutputStream() after close. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies setOutputStream() method after close.", - targets = { - @TestTarget( - methodName = "setOutputStream", - methodArgs = {java.io.OutputStream.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies setOutputStream() method after close.", + method = "setOutputStream", + args = {java.io.OutputStream.class} + ) public void testSetOutputStream_AfterClose() { ByteArrayOutputStream aos = new ByteArrayOutputStream(); MockStreamHandler h = new MockStreamHandler(aos, new MockFormatter()); @@ -1253,16 +1118,12 @@ public class StreamHandlerTest extends TestCase { /* * Test setOutputStream() when having insufficient privilege. */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies setOutputStream() method when having insufficient " + - "privilege.", - targets = { - @TestTarget( - methodName = "setOutputStream", - methodArgs = {java.io.OutputStream.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies setOutputStream() method when having insufficient privilege.", + method = "setOutputStream", + args = {java.io.OutputStream.class} + ) public void testSetOutputStream_InsufficientPrivilege() { MockStreamHandler h = new MockStreamHandler(); SecurityManager oldMan = System.getSecurityManager(); diff --git a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/XMLFormatterTest.java b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/XMLFormatterTest.java index 4d1567a..d8ee15f 100644 --- a/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/XMLFormatterTest.java +++ b/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/XMLFormatterTest.java @@ -17,9 +17,9 @@ package org.apache.harmony.logging.tests.java.util.logging; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import junit.framework.TestCase; @@ -51,14 +51,26 @@ public class XMLFormatterTest extends TestCase { * test for constructor public XMLFormatter() * */ - @TestInfo - (level = TestLevel.COMPLETE, - purpose = "", - targets = - { - @TestTarget(methodName = "XMLFormatter", methodArgs = {}) - } - ) + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "XMLFormatter", + args = {} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getHead", + args = {java.util.logging.Handler.class} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getTail", + args = {java.util.logging.Handler.class} + ) + }) public void testXMLFormatter() { String result = formatter.getHead(handler); int headPos = result @@ -76,14 +88,12 @@ public class XMLFormatterTest extends TestCase { .getTail(handler).indexOf("/log>") > 0); } - @TestInfo - (level = TestLevel.COMPLETE, - purpose = "", - targets = - { - @TestTarget(methodName = "format", methodArgs = {LogRecord.class}) - } - ) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "format", + args = {java.util.logging.LogRecord.class} + ) public void testLocalFormat() { // if set resource bundle, output will use localized message, // but put the original message into the key element @@ -115,14 +125,12 @@ public class XMLFormatterTest extends TestCase { assertTrue(result.indexOf("<key>") < 0); } - @TestInfo - (level = TestLevel.COMPLETE, - purpose = "", - targets = - { - @TestTarget(methodName = "format", methodArgs = {LogRecord.class}) - } - ) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "format", + args = {java.util.logging.LogRecord.class} + ) public void testFullFormat() { lr.setSourceClassName("source class"); lr.setSourceMethodName("source method"); @@ -155,14 +163,12 @@ public class XMLFormatterTest extends TestCase { assertTrue(output.indexOf("<key>pattern</key>") > 0); } - @TestInfo - (level = TestLevel.COMPLETE, - purpose = "", - targets = - { - @TestTarget(methodName = "format", methodArgs = {LogRecord.class}) - } - ) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "format", + args = {java.util.logging.LogRecord.class} + ) public void testFormat() { String output = formatter.format(lr); // System.out.println(output); @@ -182,14 +188,12 @@ public class XMLFormatterTest extends TestCase { assertTrue(output.indexOf("<key>") < 0); } - @TestInfo - (level = TestLevel.COMPLETE, - purpose = "", - targets = - { - @TestTarget(methodName = "getHead", methodArgs = {Handler.class}) - } - ) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getHead", + args = {java.util.logging.Handler.class} + ) public void testGetHead() throws SecurityException, UnsupportedEncodingException { String result = formatter.getHead(handler); @@ -221,14 +225,12 @@ public class XMLFormatterTest extends TestCase { /* * test for method public String getTail(Handler h) */ - @TestInfo - (level = TestLevel.COMPLETE, - purpose = "", - targets = - { - @TestTarget(methodName = "getTail", methodArgs = {Handler.class}) - } - ) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "getTail", + args = {java.util.logging.Handler.class} + ) public void testGetTail() { assertEquals( "Tail string with null handler should be equal expected value", @@ -241,16 +243,26 @@ public class XMLFormatterTest extends TestCase { "</log>", formatter.getTail(handler).trim()); } - @TestInfo - (level = TestLevel.COMPLETE, - purpose = "", - targets = - { - @TestTarget(methodName = "format", methodArgs = {LogRecord.class}), - @TestTarget(methodName = "getTail", methodArgs = {Handler.class}), - @TestTarget(methodName = "XMLFormatter", methodArgs = {}) - } - ) + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "format", + args = {java.util.logging.LogRecord.class} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getTail", + args = {java.util.logging.Handler.class} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "XMLFormatter", + args = {} + ) + }) public void testInvalidParameter() { formatter.getTail(null); try { diff --git a/logging/src/test/java/tests/logging/AllTests.java b/logging/src/test/java/tests/logging/AllTests.java index 2b89b52..c6032df 100644 --- a/logging/src/test/java/tests/logging/AllTests.java +++ b/logging/src/test/java/tests/logging/AllTests.java @@ -30,7 +30,7 @@ public class AllTests { } public static Test suite() { - TestSuite suite = new TestSuite("All Logging test suites"); + TestSuite suite = tests.TestSuiteFactory.createTestSuite("All Logging test suites"); // $JUnit-BEGIN$ suite.addTest(org.apache.harmony.logging.tests.java.util.logging.AllTests.suite()); // $JUnit-END$ |