int numChildren = parent.getNumChildren();
FormatInstanceMock[] formatInstanceMocks =
new FormatInstanceMock[numChildren];
for (int i = 0; i < numChildren; i++) {
formatInstanceMocks[i] = new FormatInstanceMock(
"formatInstanceMocks[" + i + "]", expectations,
index);
}
// Initialise the format context.
for (int i = 0; i < numChildren; i++) {
FormatMock formatMock = (FormatMock) parent.getChildAt(i);
FormatInstanceMock instanceMock = formatInstanceMocks[i];
// Create an association between the child instance and its format.
connectFormatInstanceToFormat(
formatRendererContextMock, instanceMock.expects,
formatMock, index);