diff --git a/openid-connect-server/src/main/java/org/mitre/openid/connect/service/impl/DefaultApprovedSiteService.java b/openid-connect-server/src/main/java/org/mitre/openid/connect/service/impl/DefaultApprovedSiteService.java index 956c04cfb..4e1bbf30f 100644 --- a/openid-connect-server/src/main/java/org/mitre/openid/connect/service/impl/DefaultApprovedSiteService.java +++ b/openid-connect-server/src/main/java/org/mitre/openid/connect/service/impl/DefaultApprovedSiteService.java @@ -42,22 +42,6 @@ public class DefaultApprovedSiteService implements ApprovedSiteService { @Autowired private ApprovedSiteRepository approvedSiteRepository; - /** - * Default constructor - */ - public DefaultApprovedSiteService() { - - } - - /** - * Constructor for use in test harnesses. - * - * @param repository - */ - public DefaultApprovedSiteService(ApprovedSiteRepository approvedSiteRepository) { - this.approvedSiteRepository = approvedSiteRepository; - } - @Override public Collection getAll() { return approvedSiteRepository.getAll(); diff --git a/openid-connect-server/src/test/java/org/mitre/openid/connect/service/impl/TestDefaultApprovedSiteService.java b/openid-connect-server/src/test/java/org/mitre/openid/connect/service/impl/TestDefaultApprovedSiteService.java index a6c9d0575..2257812f1 100644 --- a/openid-connect-server/src/test/java/org/mitre/openid/connect/service/impl/TestDefaultApprovedSiteService.java +++ b/openid-connect-server/src/test/java/org/mitre/openid/connect/service/impl/TestDefaultApprovedSiteService.java @@ -9,15 +9,20 @@ import java.util.Set; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mitre.oauth2.model.ClientDetailsEntity; import org.mitre.openid.connect.model.ApprovedSite; import org.mitre.openid.connect.repository.ApprovedSiteRepository; import org.mitre.openid.connect.service.ApprovedSiteService; +import org.mockito.InjectMocks; +import org.mockito.Mock; import org.mockito.Mockito; +import org.mockito.runners.MockitoJUnitRunner; import org.springframework.test.annotation.Rollback; import com.google.common.collect.Sets; +@RunWith(MockitoJUnitRunner.class) public class TestDefaultApprovedSiteService { private ApprovedSite site1; @@ -27,9 +32,13 @@ public class TestDefaultApprovedSiteService { private ClientDetailsEntity client; private final String clientId = "client"; - private ApprovedSiteService service; + @Mock private ApprovedSiteRepository repository; + @InjectMocks + private ApprovedSiteService service = new DefaultApprovedSiteService(); + + /** * Initialize the service and repository mock. Initialize a client and * several ApprovedSite objects for use in unit tests. @@ -55,9 +64,8 @@ public class TestDefaultApprovedSiteService { site3.setUserId("user2"); site3.setClientId(clientId); - repository = Mockito.mock(ApprovedSiteRepository.class); - - service = new DefaultApprovedSiteService(repository); + Mockito.reset(repository); + } /**