@Test public void testGetAsset() { Platform oldPlatform = PlatformAccess.getPlatform(); Platform mockPlatform = Mockito.mock(Platform.class); CoreComponentRegistry mockRegistry = Mockito.mock(CoreComponentRegistry.class); Icon mockIcon = Mockito.mock(Icon.class); TypeInfo<?> info = new TypeInfo<TypeInfoTest>(TypeInfoTest.class){}; new PlatformAccess().setPlatform(null); Assert.assertNull(info.getAsset(Icon.class)); new PlatformAccess().setPlatform(mockPlatform); Assert.assertNull(info.getAsset(Icon.class)); Mockito.when(mockPlatform.getComponentRegistry()).thenReturn(mockRegistry); Assert.assertNull(info.getAsset(Icon.class)); Mockito.when(mockRegistry.getAsset(info, Icon.class)).thenReturn(mockIcon); Assert.assertEquals(info.getAsset(Icon.class), mockIcon); new PlatformAccess().setPlatform(oldPlatform); }
public <A> A getAsset(Class<A> assetClass) { Platform platform = PlatformAccess.getPlatform(); if (platform != null) { CoreComponentRegistry registry = platform.getComponentRegistry(); if (registry != null) { return registry.getAsset(this, assetClass); } } return null; }
TypeInfo { public <A> A getAsset(Class<A> assetClass) { Platform platform = PlatformAccess.getPlatform(); if (platform != null) { CoreComponentRegistry registry = platform.getComponentRegistry(); if (registry != null) { return registry.getAsset(this, assetClass); } } return null; } }
TypeInfo { public <A> A getAsset(Class<A> assetClass) { Platform platform = PlatformAccess.getPlatform(); if (platform != null) { CoreComponentRegistry registry = platform.getComponentRegistry(); if (registry != null) { return registry.getAsset(this, assetClass); } } return null; } TypeInfo(Class<? extends T> typeClass); }
TypeInfo { public <A> A getAsset(Class<A> assetClass) { Platform platform = PlatformAccess.getPlatform(); if (platform != null) { CoreComponentRegistry registry = platform.getComponentRegistry(); if (registry != null) { return registry.getAsset(this, assetClass); } } return null; } TypeInfo(Class<? extends T> typeClass); Class<? extends T> getTypeClass(); A getAsset(Class<A> assetClass); }
TypeInfo { public <A> A getAsset(Class<A> assetClass) { Platform platform = PlatformAccess.getPlatform(); if (platform != null) { CoreComponentRegistry registry = platform.getComponentRegistry(); if (registry != null) { return registry.getAsset(this, assetClass); } } return null; } TypeInfo(Class<? extends T> typeClass); Class<? extends T> getTypeClass(); A getAsset(Class<A> assetClass);  }