}
@Test (dataProvider="assetTestCases")
public <T> void testGetAsset(int count, int found, T asset, Class<T> clazz) {
// Setup some mock providers to look at for assets
ComponentProvider mockDefaultProvider = Mockito.mock(ComponentProvider.class);
ExtendedComponentProvider mockProviders[] = new ExtendedComponentProvider[count];
TypeInfo<?> mockTypeInfo = Mockito.mock(TypeInfo.class);
for (int i = 0; i < count; i++) {
mockProviders[i] = Mockito.mock(ExtendedComponentProvider.class, "provider" + i);
}
// Find the expected item in provider "found" (with default provider at end)
if (found < count) {
Mockito.when(mockProviders[found].getAsset(mockTypeInfo, clazz)).thenReturn(asset);
} else if (found == count) {
Mockito.when(mockDefaultProvider.getAsset(mockTypeInfo, clazz)).thenReturn(asset);
}
registry.setDefaultViewProvider(mockDefaultProvider);
registry.refreshComponents(Arrays.asList(mockProviders));
// Should find the object, unless found > count