Re: JCHEVM built on GCC/Cygwin
Hey, that's great! Now lets get JCHEVM to also use the Harmony Classlib :) It will be great for A/B testing. geir Enrico Migliore wrote: Hi folks, I've finally built JCHEVM and Classpath 0.20 on GCC/Cygwin/Windows. There are still a few things to fix and port but the main job is done. At the moment, when calling: $jc HelloWorld.class jc throws an exception because it can't find a .so library in Classpath. ciao, Enrico
[jira] Closed: (HARMONY-45) Charset.isRegistered() method always return true
[ http://issues.apache.org/jira/browse/HARMONY-45?page=all ] Tim Ellison closed HARMONY-45: -- Validated by Vladimir. > Charset.isRegistered() method always return true > > > Key: HARMONY-45 > URL: http://issues.apache.org/jira/browse/HARMONY-45 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Vladimir Strigun > Assignee: Tim Ellison > Priority: Trivial > > In accordance with J2SE specification method isRegistered() should return > true only if charset is registered with IANA. > As well, "if a supported charset is not listed in the IANA registry then its > canonical name must begin with one of the strings "X-" or "x-" > Testcase shows that even if charset name begin with "x-" isRegistered returns > true; -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (HARMONY-45) Charset.isRegistered() method always return true
[ http://issues.apache.org/jira/browse/HARMONY-45?page=comments#action_12364478 ] Vladimir Strigun commented on HARMONY-45: - I'm ok with this fix. > Charset.isRegistered() method always return true > > > Key: HARMONY-45 > URL: http://issues.apache.org/jira/browse/HARMONY-45 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Vladimir Strigun > Assignee: Tim Ellison > Priority: Trivial > > In accordance with J2SE specification method isRegistered() should return > true only if charset is registered with IANA. > As well, "if a supported charset is not listed in the IANA registry then its > canonical name must begin with one of the strings "X-" or "x-" > Testcase shows that even if charset name begin with "x-" isRegistered returns > true; -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
Re: Contribution of beans, math and regex libraries
Hi Andrey, Certainly the Bouncy Castle jar contains an implementation of the SHA algorithm. Assuming that you have an uncorrupted BC provider jar in /lib/ext, does this failure get fixed by "unsigning" the BC jar ? I hit something similar a few days ago (NoSuchAlgorithmException even though BC was providing it) and it got fixed by unsigning the provider jar. Maybe there is a bootstrapping problem verifying the signed BC provider jar ? I'm not sure if there is an open JIRA issue on this. Best regards, George IBM UK Andrey Chernyshev wrote: java.beans.PropertyChangeSupportTest First two tests were mentioned in the contribution's README.txt that they may fail. The last one failed on serialization. Yes, you are right. As far as I can see the PropertyChangeSupportTest fails with the following message: java.security.NoSuchAlgorithmException: SHA Serialization code has to compute the default SUID. To do that, it requests message digest with SHA algorithm, e.g. does something like: digest = java.security.MessageDigest.getInstance("SHA"); and then fails to get SHA with the default provider package. Could it be related to the new security code integration? Were you able to pass security2 tests which utilize SHA? Thank you, Andrey Chernyshev Intel Middleware Products Division On 1/30/06, Stepan Mishura <[EMAIL PROTECTED]> wrote: I tried this contribution in the following way: I've substituted the current java.math stub implementation with implementation from the contribution. And I run all security2 tests - most of tests that depend on java.math.BigInteger class passed. Also I run tests from the contribution. All tests passed except java.beans.EventHandlerTest java.beans.SimpleBeanInfoTest java.beans.PropertyChangeSupportTest First two tests were mentioned in the contribution's README.txt that they may fail. The last one failed on serialization. Thanks, Stepan Mishura Intel Middleware Products Division On 1/23/06, Andrey Chernyshev <[EMAIL PROTECTED]> wrote: I'm happy to announce one more contribution to Harmony on behalf of Intel. The archive with the contribution is uploaded to the following location: http://issues.apache.org/jira/browse/HARMONY-39 The contribution includes the following class library packages: 1) java.beans 2) java.math 3) java.util.regex Note that this contribution includes stubs for certain classes from the java.awt and java.applet packages as well to enable compilation of java.beans. The stub classes do not yet include the complete method signatures or their fully-functional implementations. Please be prepared to observe some unit test failures in the beans package because of that. The code is a result of efforts of Intel Middleware Product Division team. One should be able to compile and run this code with the Harmony Execution Environment available at http://www-128.ibm.com/developerworks/java/jdk/harmony, Harmony Class Libraries and Eclipse compiler. The code included with the contribution is pure Java, we tested it with the Harmony Execution Environment on Windows and Linux. The implementation is done according to the Java 5 API specification, though the Java 5 specific language features such as generics were not utilized. One should be able to run this code with a 1.4+compatible JRE/VM. The build provided with the contribution doesn't include the documentation target yet until we work out the approach to handling the references to J2SE spec (we haven't yet removed the com.intel.drl.spec_ref tags from the code). We hope that the proposed regex package would allow developing the fully- functional build makefiles for Ant. The detailed documentation regarding the regex framework can be found under the 'doc' directory. The archive contains the README file that explains the things doable with this code. But, should any additional clarifications be required, I'll be happy to provide them. You are welcome to try it out! Thank you, Andrey Chernyshev Intel Middleware Products Division -- Thanks, Stepan Mishura Intel Middleware Products Division
Re: Contribution of beans, math and regex libraries
> java.beans.PropertyChangeSupportTest > > First two tests were mentioned in the contribution's README.txt that they > may fail. The last one failed on serialization. Yes, you are right. As far as I can see the PropertyChangeSupportTest fails with the following message: java.security.NoSuchAlgorithmException: SHA Serialization code has to compute the default SUID. To do that, it requests message digest with SHA algorithm, e.g. does something like: digest = java.security.MessageDigest.getInstance("SHA"); and then fails to get SHA with the default provider package. Could it be related to the new security code integration? Were you able to pass security2 tests which utilize SHA? Thank you, Andrey Chernyshev Intel Middleware Products Division On 1/30/06, Stepan Mishura <[EMAIL PROTECTED]> wrote: > I tried this contribution in the following way: I've substituted the current > java.math stub implementation with implementation from the contribution. And > I run all security2 tests - most of tests that depend on > java.math.BigInteger class passed. > > Also I run tests from the contribution. All tests passed except > java.beans.EventHandlerTest > java.beans.SimpleBeanInfoTest > java.beans.PropertyChangeSupportTest > > First two tests were mentioned in the contribution's README.txt that they > may fail. The last one failed on serialization. > > Thanks, > Stepan Mishura > Intel Middleware Products Division > > > > On 1/23/06, Andrey Chernyshev <[EMAIL PROTECTED]> wrote: > > > > I'm happy to announce one more contribution to Harmony on behalf of > > Intel. The archive with the contribution is uploaded to the following > > location: > > > > http://issues.apache.org/jira/browse/HARMONY-39 > > > > The contribution includes the following class library packages: > > > > 1) java.beans > > 2) java.math > > 3) java.util.regex > > > > Note that this contribution includes stubs for certain classes from the > > java.awt and java.applet packages as well to enable compilation of > > java.beans. The stub classes do not yet include the complete method > > signatures > > or their fully-functional implementations. Please be prepared to observe > > some > > unit test failures in the beans package because of that. > > > > The code is a result of efforts of Intel Middleware Product Division team. > > One > > should be able to compile and run this code with the Harmony Execution > > Environment available at > > http://www-128.ibm.com/developerworks/java/jdk/harmony, > > Harmony Class Libraries and Eclipse compiler. The code included with the > > contribution is pure Java, we tested it with the Harmony Execution > > Environment > > on Windows and Linux. The implementation is done according to the Java 5 > > API > > specification, though the Java 5 specific language features such as > > generics > > were not utilized. One should be able to run this code with a 1.4+compatible > > JRE/VM. > > > > The build provided with the contribution doesn't include the documentation > > target yet until we work out the approach to handling the references to > > J2SE > > spec (we haven't yet removed the com.intel.drl.spec_ref tags from the > > code). > > > > We hope that the proposed regex package would allow developing the fully- > > functional build makefiles for Ant. The detailed documentation regarding > > the > > regex framework can be found under the 'doc' directory. > > > > The archive contains the README file that explains the things doable with > > this > > code. But, should any additional clarifications be required, I'll be happy > > to > > provide them. You are welcome to try it out! > > > > Thank you, > > Andrey Chernyshev > > Intel Middleware Products Division > > > > > > -- > Thanks, > Stepan Mishura > Intel Middleware Products Division > >
[jira] Resolved: (HARMONY-45) Charset.isRegistered() method always return true
[ http://issues.apache.org/jira/browse/HARMONY-45?page=all ] Tim Ellison resolved HARMONY-45: Resolution: Fixed Vladimir, Fixed in NIO_CHAR java.nio.charset.Charset at repo revision 373510. Please check this fully resolves your problem. > Charset.isRegistered() method always return true > > > Key: HARMONY-45 > URL: http://issues.apache.org/jira/browse/HARMONY-45 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Vladimir Strigun > Assignee: Tim Ellison > Priority: Trivial > > In accordance with J2SE specification method isRegistered() should return > true only if charset is registered with IANA. > As well, "if a supported charset is not listed in the IANA registry then its > canonical name must begin with one of the strings "X-" or "x-" > Testcase shows that even if charset name begin with "x-" isRegistered returns > true; -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (HARMONY-55) remove PerformanceTest from hierarchy of unit tests in security2
[ http://issues.apache.org/jira/browse/HARMONY-55?page=all ] Mikhail Loenko updated HARMONY-55: -- Attachment: patch.txt Replaces 'extends PerformanceTest' with 'extends TestCase' Removes redundant 'logln' Some tests refactored to return test result in the status rather than in the log file > remove PerformanceTest from hierarchy of unit tests in security2 > > > Key: HARMONY-55 > URL: http://issues.apache.org/jira/browse/HARMONY-55 > Project: Harmony > Type: Improvement > Reporter: Mikhail Loenko > Attachments: patch.txt > > As it was discussed in the mail threads PerfromanceTest class should be > removed from hierarchy of unit tests in security2, > the tests should extend TestCase class. > The tests should be refactored to remove redundant logging that is currently > done via PerformanceTest. > I'm going to provide a patch in a day or two -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
Re: [testing] code for exotic configurations
I'd like to add two my kopeks :-) Example, KerberosKey class depends on DES-based encryption to generate a DES key from a user's password. A test may looks like the following: // Test data from RFC 3961 (http://www.ietf.org/rfc/rfc3961.txt) public void testGetEncoded() { byte[] expected = new byte[] { (byte) 0xcb, (byte) 0xc2, (byte) 0x2f, (byte) 0xae, (byte) 0x23, (byte) 0x52, (byte) 0x98, (byte) 0xe3 }; KerberosPrincipal kp = new KerberosPrincipal("[EMAIL PROTECTED]", 1); KerberosKey key = new KerberosKey(kp, "password". toCharArray(), "DES"); assertTrue(Arrays.equals(expected, key.getEncoded())); } To run the test above the test's configuration has to include a provider that provides required encryption type. I'm not comfort with mocking provider implementation because this complicates tests development: I need to write additional code for each similar case (that is not a couple of lines) instead of using free provider or harmony provider (if we'll have one) for testing purposes. I wouldn't call this test 'a system test': it doesn't verify an underlying system and a provider implementation. It just checks that KerberosKey class has correct implementation. Also it doesn't look like as was written early "quite complicated and can hardly perform the required environment settings (tools installation, platform configuration, etc) from JUnit test." Even more I won't use KerberosKey(KerberosPrincipal,char[], String) constructor in any other testing scenarios. Otherwise I have to put it in a 'system test suite'. Thanks, Stepan Mishura Intel Middleware Products Division On 1/26/06, Mikhail Loenko <[EMAIL PROTECTED]> wrote: > > Well let's start a new thread as this is more general problem. > > So if we have some code designed for some exotic configurations > and we have tests that verify that exotic code. > > The test when run in usual configuration (not exotic one) should > report something that would not scare people. But if one > wants to test that specific exotic configuration that he should be > able to easily verify that he successfully made required conf and > the test worked well. > > The following options I see here: > 1) introduce a new test status (like skipped) to mark those tests that > did not actually run > 2) agree on exact wording that the skipped tests would print to allow > grep logs later > 3) introduce tests-indicators that would fail when current > configuration disallow > running certain tests > > Please let me know what you think > > Thanks, > Mikhail Loenko > Intel Middleware Products Division > -- Thanks, Stepan Mishura Intel Middleware Products Division
[jira] Assigned: (HARMONY-45) Charset.isRegistered() method always return true
[ http://issues.apache.org/jira/browse/HARMONY-45?page=all ] Tim Ellison reassigned HARMONY-45: -- Assign To: Tim Ellison > Charset.isRegistered() method always return true > > > Key: HARMONY-45 > URL: http://issues.apache.org/jira/browse/HARMONY-45 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Vladimir Strigun > Assignee: Tim Ellison > Priority: Trivial > > In accordance with J2SE specification method isRegistered() should return > true only if charset is registered with IANA. > As well, "if a supported charset is not listed in the IANA registry then its > canonical name must begin with one of the strings "X-" or "x-" > Testcase shows that even if charset name begin with "x-" isRegistered returns > true; -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
Re: Contribution of beans, math and regex libraries
I tried this contribution in the following way: I've substituted the current java.math stub implementation with implementation from the contribution. And I run all security2 tests - most of tests that depend on java.math.BigInteger class passed. Also I run tests from the contribution. All tests passed except java.beans.EventHandlerTest java.beans.SimpleBeanInfoTest java.beans.PropertyChangeSupportTest First two tests were mentioned in the contribution's README.txt that they may fail. The last one failed on serialization. Thanks, Stepan Mishura Intel Middleware Products Division On 1/23/06, Andrey Chernyshev <[EMAIL PROTECTED]> wrote: > > I'm happy to announce one more contribution to Harmony on behalf of > Intel. The archive with the contribution is uploaded to the following > location: > > http://issues.apache.org/jira/browse/HARMONY-39 > > The contribution includes the following class library packages: > > 1) java.beans > 2) java.math > 3) java.util.regex > > Note that this contribution includes stubs for certain classes from the > java.awt and java.applet packages as well to enable compilation of > java.beans. The stub classes do not yet include the complete method > signatures > or their fully-functional implementations. Please be prepared to observe > some > unit test failures in the beans package because of that. > > The code is a result of efforts of Intel Middleware Product Division team. > One > should be able to compile and run this code with the Harmony Execution > Environment available at > http://www-128.ibm.com/developerworks/java/jdk/harmony, > Harmony Class Libraries and Eclipse compiler. The code included with the > contribution is pure Java, we tested it with the Harmony Execution > Environment > on Windows and Linux. The implementation is done according to the Java 5 > API > specification, though the Java 5 specific language features such as > generics > were not utilized. One should be able to run this code with a 1.4+compatible > JRE/VM. > > The build provided with the contribution doesn't include the documentation > target yet until we work out the approach to handling the references to > J2SE > spec (we haven't yet removed the com.intel.drl.spec_ref tags from the > code). > > We hope that the proposed regex package would allow developing the fully- > functional build makefiles for Ant. The detailed documentation regarding > the > regex framework can be found under the 'doc' directory. > > The archive contains the README file that explains the things doable with > this > code. But, should any additional clarifications be required, I'll be happy > to > provide them. You are welcome to try it out! > > Thank you, > Andrey Chernyshev > Intel Middleware Products Division > -- Thanks, Stepan Mishura Intel Middleware Products Division
JCHEVM built on GCC/Cygwin
Hi folks, I've finally built JCHEVM and Classpath 0.20 on GCC/Cygwin/Windows. There are still a few things to fix and port but the main job is done. At the moment, when calling: $jc HelloWorld.class jc throws an exception because it can't find a .so library in Classpath. ciao, Enrico
[jira] Updated: (HARMONY-54) java.io.BufferedReader.read(null,int off,int len) does not throw NPE when len==0
[ http://issues.apache.org/jira/browse/HARMONY-54?page=all ] Tim Ellison updated HARMONY-54: --- Estimated Complexity: Novice > java.io.BufferedReader.read(null,int off,int len) does not throw NPE when > len==0 > > > Key: HARMONY-54 > URL: http://issues.apache.org/jira/browse/HARMONY-54 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Vladimir Ivanov > Attachments: BufferedReaderTest.java > > In java.io package description j2se 1.4.2 specification says, that unless > otherwise noted, passing a null argument to a constructor or method in any > class or interface in this package will cause a NullPointerException to be > thrown. > But java.io.BufferedReader.read(null,int off,int len) does not throw NPE when > len==0 > Code to reproduce: > import java.io.*; > > public class test29 { > public static void main(String[] args) { > char []ch = {}; > char [] s = null; > BufferedReader toRet = new BufferedReader(new CharArrayReader(ch)); > try { > System.out.println("read(s, 1, 0)= " + toRet.read(s, 1, 0)); > } catch (Exception t) { > System.out.println("Exception: " + t); > } > try { > System.out.println("read(s, 1, 1)= " + toRet.read(s, 1, 1)); > } catch (Exception t) { > System.out.println("Exception: " + t); > } >} > } > Steps to Reproduce: > 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in > README.txt. > 2. Compile test29.java using BEA 1.4 javac > > javac -d . test29.java > 3. Run java using compatible VM (J9) > > java -showversion test29 > Output: > C:\tmp\tmp17>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test29 > java version "1.4.2_04" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05) > BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build > ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel) > Exception: java.lang.NullPointerException > Exception: java.lang.NullPointerException > C:\tmp\tmp17>C:\harmony\trunk\deploy\jre\bin\java -showversion test29 > java version 1.4.2 (subset) > (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as > applicable. > read(s, 1, 0)= 0 > Exception: java.lang.NullPointerException > C:\tmp\tmp17> > junit test: > BufferedReaderTest.java > - > import java.io.*; > import junit.framework.*; > > public class BufferedReaderTest extends TestCase { > public static void main(String[] args) { > junit.textui.TestRunner.run(BufferedReaderTest.class); > } > public void testHashCode() { > char []ch = {}; > BufferedReader toRet = new BufferedReader(new CharArrayReader(ch)); > try { > toRet.read(null, 1, 0); > fail("NullPointerException expected"); > } catch (NullPointerException e) { > } catch (Exception e) { > fail("Unexpected exception: " + e); > } > } > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (HARMONY-54) java.io.BufferedReader.read(null,int off,int len) does not throw NPE when len==0
[ http://issues.apache.org/jira/browse/HARMONY-54?page=all ] Tim Ellison updated HARMONY-54: --- Attachment: BufferedReaderTest.java I've attached an enhanced testcase that also checks the order of exception throwing. > java.io.BufferedReader.read(null,int off,int len) does not throw NPE when > len==0 > > > Key: HARMONY-54 > URL: http://issues.apache.org/jira/browse/HARMONY-54 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Vladimir Ivanov > Attachments: BufferedReaderTest.java > > In java.io package description j2se 1.4.2 specification says, that unless > otherwise noted, passing a null argument to a constructor or method in any > class or interface in this package will cause a NullPointerException to be > thrown. > But java.io.BufferedReader.read(null,int off,int len) does not throw NPE when > len==0 > Code to reproduce: > import java.io.*; > > public class test29 { > public static void main(String[] args) { > char []ch = {}; > char [] s = null; > BufferedReader toRet = new BufferedReader(new CharArrayReader(ch)); > try { > System.out.println("read(s, 1, 0)= " + toRet.read(s, 1, 0)); > } catch (Exception t) { > System.out.println("Exception: " + t); > } > try { > System.out.println("read(s, 1, 1)= " + toRet.read(s, 1, 1)); > } catch (Exception t) { > System.out.println("Exception: " + t); > } >} > } > Steps to Reproduce: > 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in > README.txt. > 2. Compile test29.java using BEA 1.4 javac > > javac -d . test29.java > 3. Run java using compatible VM (J9) > > java -showversion test29 > Output: > C:\tmp\tmp17>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test29 > java version "1.4.2_04" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05) > BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build > ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel) > Exception: java.lang.NullPointerException > Exception: java.lang.NullPointerException > C:\tmp\tmp17>C:\harmony\trunk\deploy\jre\bin\java -showversion test29 > java version 1.4.2 (subset) > (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as > applicable. > read(s, 1, 0)= 0 > Exception: java.lang.NullPointerException > C:\tmp\tmp17> > junit test: > BufferedReaderTest.java > - > import java.io.*; > import junit.framework.*; > > public class BufferedReaderTest extends TestCase { > public static void main(String[] args) { > junit.textui.TestRunner.run(BufferedReaderTest.class); > } > public void testHashCode() { > char []ch = {}; > BufferedReader toRet = new BufferedReader(new CharArrayReader(ch)); > try { > toRet.read(null, 1, 0); > fail("NullPointerException expected"); > } catch (NullPointerException e) { > } catch (Exception e) { > fail("Unexpected exception: " + e); > } > } > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Created: (HARMONY-55) remove PerformanceTest from hierarchy of unit tests in security2
remove PerformanceTest from hierarchy of unit tests in security2 Key: HARMONY-55 URL: http://issues.apache.org/jira/browse/HARMONY-55 Project: Harmony Type: Improvement Reporter: Mikhail Loenko As it was discussed in the mail threads PerfromanceTest class should be removed from hierarchy of unit tests in security2, the tests should extend TestCase class. The tests should be refactored to remove redundant logging that is currently done via PerformanceTest. I'm going to provide a patch in a day or two -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
Re: [testing] code for exotic configurations
On 1/30/06, Anton Avtamonov <[EMAIL PROTECTED]> wrote: > On 1/29/06, Mikhail Loenko <[EMAIL PROTECTED]> wrote: > > P.S. There are also 'integration' tests that verify how different 'units' > > work together. > > > > I think the areas of various tests intersect and it would be good to define > > them on this early stage > > > > Well, agree. And I think our discussion is exactly about to define > what is right unit, integration and system testing. > > Talking about how real unit test should be prepared I'd like to give > some example: I like examples :) > > There is a method java.awt.Toolkit.getDefaultToolkit().getScreenSize() > which returns the current screen size. > Let's assume there is some functionality which works differently > depending on actual screen size. You are going to test that > functionality. > The first approach (as I understand that is what you are using) is to: > - if the screen resolution is as expected - do testing > - otherwise skip the test. > > Another approach (which I think to be more appropriate) is: > - override getScreenSize() method of some 'TestToolkit' and install it > as 'default toolkit' in the test setUp, so that it returns the desired > value for the particular test. > This gives me an ability to write all necessary tests and cover all > the paths of my functionality which depend on screen size. Well, getScreenSize() returns a number, and it is possible to loop through valid (and some invalid but possible) values and test with them. But what if the method returns an AlgorithmParameters *implementation* or a certificate in encoded form (which is byte array)? Thanks, Mikhail. > > Note that I'm not going to re-create all other classes of JSEE :-). I > need to control getScreenSize() only and have to create the required > mock-object to achieve that. > > -- > Anton Avtamonov, > Intel Middleware Products Division >
[jira] Closed: (HARMONY-24) java.net.URLEncoder.encode(String s, String enc) doesn't throw UnsupportedEncodingException
[ http://issues.apache.org/jira/browse/HARMONY-24?page=all ] Tim Ellison closed HARMONY-24: -- Validated by Vladimir. > java.net.URLEncoder.encode(String s, String enc) doesn't throw > UnsupportedEncodingException > --- > > Key: HARMONY-24 > URL: http://issues.apache.org/jira/browse/HARMONY-24 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Vladimir Strigun > Assignee: Tim Ellison > > Corresponding to API specification method encode(String, String) of > java.net.URLEncoder should throw "UnsupportedEncodingException - If the named > encoding is not supported". But the test shows that Harmony implementation > doesn't throw an exception. > import java.io.UnsupportedEncodingException; > import java.net.URLEncoder; > public class Test { > public static void main(String[] args) { > try { > > System.out.println("URLEncoder.encode="+URLEncoder.encode("str","unknown_enc")); > > } catch (UnsupportedEncodingException e) { > e.printStackTrace(); > } > } > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira