2011/7/1 Sharma, Ashish <[email protected]>: > Norman, > > I got the following idea from one of the forums: > > "decode the attachments and then re-encode them. If the re-encoded stream > matches (byte-for-byte) the original, then that's a good sign that mime4j is > properly handling them"
This won't work. Serialization is not done byte per byte identical to the original version. It is semantically identical, but not byte per byte. E.g: the way mime4j encodes quoted-printable or base64 is hardcoded and cannot match any input encoding. There's no way you can automatically verify if parsing is correct: what we do is parsing using perl mime tools tests that generates xml files in the same format we generate them using our testsuite. At most you can check if mime4j results equals perl mime tools results and manually check where it doesn't match. We have a test suite, if you believe a message is not correctly parsed submit it to us and we'll review. > http://stackoverflow.com/questions/6521010/verifying-testing-the-output-of-mime4j-parsed-content > > What is your comment on this and what classes should I use for implementing > the suggestion? As I said I consider this approach useless. > Thanks > Ashish What you ask is impossible: the fact that per parsed and rewritten message equals don't even tell you that the parsing was correct, anyway. Stefano
