In my opinion the Bug Parade is great proof of Sun's confidence and
openness.
That it is too..
Sure there are plenty of bugs, but for a set of libraries that
size it's pretty good (Swing excepted).
I believe Sun claim to have over 150,000 tests.
Let's say the latest JDK has 2500 public classes, let's say with each (on
average) 50 public methods (incl. constructors).. that gives 125,000 entry
points. Let's say 150,000 to simplify things. This would mean that Sun only
have ONE (1) test, on average, per public API method.
If that were so, I think that would suck big time. For my own library
classes I normally write unit tests for every public method and constructor,
and each unit test typically consists of between 5 to 10 different tests
(see example below). If I can hammer my library with at least 5 times more
tests than Sun does, I would expect an organization with the near-bottomless
resources of Sun's to be able to do a lot better than me, a microscopic
little fish with virtually no resources.
-------
Sample extract of my unit test code:
public void z_generateSelfTestReport(SelfTestPrintStream out, boolean
interactiveTest) {
Object[] argValues;
Class[] argTypes;
//------------------------------------------------------------
// tests for rightString()
// tests for rightStringFrom()
// tests for leftString()
// tests for leftStringTo()
argValues = new Object[] {
new Object[] {"Hello", new Integer(0) },
new Object[] {"Hello", new Integer(1) },
new Object[] {"Hello", new Integer(2) },
new Object[] {"Hello", new Integer(3) },
new Object[] {"Hello", new Integer(4) },
new Object[] {"Hello", new Integer(5) },
new Object[] {"Hello", new Integer(6) },
new Object[] {"Hello", new Integer(-1) },
new Object[] {"Hello", new Integer(-2) },
new Object[] {"Hello", new Integer(-3) },
new Object[] {"Hello", new Integer(-4) },
new Object[] {"Hello", new Integer(-5) },
new Object[] {"Hello", new Integer(-6) },
new Object[] {null , new Integer(0) },
};
argTypes = new Class[] {String.class, int.class};
out.testStaticMethod("rightString", argTypes, argValues);
out.testStaticMethod("rightStringFrom", argTypes, argValues);
out.testStaticMethod("leftString", argTypes, argValues);
out.testStaticMethod("leftStringTo", argTypes, argValues);
//------------------------------------------------------------
// tests for chopHead(String body, String tail)
argValues = new Object[] {
new Object[] {"A long sentence","A"},
new Object[] {"A long sentence","A l"},
new Object[] {"A long sentence","A long sentence"},
new Object[] {"A long sentence","long"},
new Object[] {"A long sentence",""},
};
argTypes = new Class[] {String.class, String.class};
out.testStaticMethod("chopHead", argTypes, argValues);
//------------------------------------------------------------
// tests for chopHead(String body, int tailLength)
argValues = new Object[] {
new Object[] {"A long sentence", new Integer(0)},
new Object[] {"A long sentence", new Integer(1)},
new Object[] {"A long sentence", new Integer(2)},
new Object[] {"A long sentence", new Integer(7)},
new Object[] {"A long sentence", new Integer(14)},
new Object[] {"A long sentence", new Integer(15)},
new Object[] {"A long sentence", new Integer(51)},
new Object[] {"A long sentence", new Integer(-1)},
};
argTypes = new Class[] {String.class, int.class};
out.testStaticMethod("chopHead", argTypes, argValues);
//------------------------------------------------------------
// tests for chopTail(String body, String tail)
argValues = new Object[] {
new Object[] {"A tail sentence","A"},
new Object[] {"A tail sentence","A tail sentence"},
new Object[] {"A tail sentence","sentence"},
new Object[] {"A tail sentence","nce"},
new Object[] {"A tail sentence",""},
};
argTypes = new Class[] {String.class, String.class};
out.testStaticMethod("chopTail", argTypes, argValues);
//------------------------------------------------------------
// tests for chopTail(String body, int tailLength)
argValues = new Object[] {
new Object[] {"A long sentence", new Integer(0)},
new Object[] {"A long sentence", new Integer(1)},
new Object[] {"A long sentence", new Integer(8)},
new Object[] {"A long sentence", new Integer(14)},
new Object[] {"A long sentence", new Integer(15)},
new Object[] {"A long sentence", new Integer(51)},
new Object[] {"A long sentence", new Integer(-1)},
};
argTypes = new Class[] {String.class, int.class};
out.testStaticMethod("chopTail", argTypes, argValues);
:
:
and so on. This is just a fraction of the unit tests for my StringKit
utility class.