package de.superx.saiku; import static org.junit.Assert.assertEquals; import java.lang.reflect.Field; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.Mockito; import org.saiku.service.PlatformUtilsService; /** * Test for class {@linkplain de.superx.saiku.SuperxInfoResource} * @author hiber */ public class SuperxInfoResourceTest { private SuperxInfoResource superxInfoResource = new SuperxInfoResource(); @Mock private PlatformUtilsService platformUtilsService ; @Before public void setup() throws SecurityException, IllegalArgumentException { this.platformUtilsService = Mockito.mock(PlatformUtilsService.class); } @Test public void testSetPlatformUtilsService() throws SecurityException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException { this.superxInfoResource.setPlatformUtilsService(this.platformUtilsService); Field platformServiceField = this.superxInfoResource.getClass().getDeclaredField("platformService"); platformServiceField.setAccessible(true); PlatformUtilsService privatePlatformService = (PlatformUtilsService) platformServiceField.get(this.superxInfoResource); assertEquals("passed platformUtilsService equals returned platformUtilsService", privatePlatformService, this.platformUtilsService); } }