_generator.generateSource(inputSource, getClass().getPackage()
.getName()
+ ".generated.complexContent");
// get the Source Generator's state Info
SGStateInfo sgState = _generator.getSGStateInfo();
assertNotNull(sgState);
/*
* Get all elements (=keys) the ClassInfoResolver knows of. For these
* keys the SourceGenerator created ClassInfos in which we are
* interested.
*/
Enumeration enumeration = sgState.keys();
assertTrue(enumeration.hasMoreElements());
List cInfos = new ArrayList();
/*
* Get all ClassInfos. Note that during the source generation process
* ClassInfos are actually added twice to the ClassInfoResolver's cache:
* - once with the XMLBindingComponent/ClassInfo
* - and with the JClass/ClassInfo
* as key/value pair.
* Therefore we only get those ClassInfos with a
* XMLBindingComponent/ClassInfo pair to avoid duplicates!
*/
while (enumeration.hasMoreElements()) {
Object elem = enumeration.nextElement();
if (!(elem instanceof JClass)) {
cInfos.add(sgState.resolve(elem));
}
}
assertEquals(2, cInfos.size());