protected ProviderRestService getTested() { ProviderRestService tested = new ProviderRestService(); RestEntityServiceBaseTest.mockLogger(tested); tested.providerService = Mockito.mock(ProviderService.class); tested.setEntityService(Mockito.mock(ProviderService.class)); tested.securityService = Mockito.mock(SecurityService.class); tested.securityContext = new ProviderCustomSecurityContext(new SimplePrincipal("aa"), false, true, "Basic"); return tested; }
@Test public void init() { ProviderRestService tested = new ProviderRestService(); tested.log = Logger.getLogger("testlogger"); Assert.assertNull(tested.entityService); tested.providerService = Mockito.mock(ProviderService.class); // EntityService es = Mockito.mock(ProviderService.class); Assert.assertNull(tested.entityService); tested.init(); // Assert.assertEquals(es, tested.entityService); }