/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see http://www.gnu.org/licenses/
 */
package org.phenotips.data.rest.internal;

import groovy.transform.stc.ThirdParam;
import org.junit.Before;
import org.junit.Rule;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.phenotips.data.PatientRepository;
import org.phenotips.data.rest.DomainObjectFactory;
import org.phenotips.data.rest.model.Patient;
import org.slf4j.Logger;
import org.xwiki.component.manager.ComponentLookupException;
import org.xwiki.model.reference.EntityReference;
import org.xwiki.model.reference.EntityReferenceResolver;
import org.xwiki.query.QueryManager;
import org.xwiki.rest.XWikiRestComponent;
import org.xwiki.security.authorization.AuthorizationManager;
import org.xwiki.test.mockito.MockitoComponentMockingRule;
import org.xwiki.users.UserManager;

import javax.inject.Inject;
import javax.inject.Named;

public class DefaultPatientByExternalIdResourceImplTest {

    @Rule
    public final MockitoComponentMockingRule<XWikiRestComponent> mocker =
            new MockitoComponentMockingRule<XWikiRestComponent>(DefaultPatientByExternalIdResourceImpl.class);

    @Mock
    private Patient patiet;

    private Logger logger;

    private PatientRepository repository;

    private DomainObjectFactory factory;

    private QueryManager qm;

    private AuthorizationManager access;

    private UserManager users;

    private EntityReferenceResolver<EntityReference> currentResolver;

    @Before
    public void setUp() throws ComponentLookupException
    {
        MockitoAnnotations.initMocks(this);
        this.currentResolver = this.mocker.getInstance(EntityReferenceResolver.TYPE_STRING, "explicit");
    }
}

@@ -825,48 +825,8 @@
 l;%0A%0A
-import groovy.transform.stc.ThirdParam;%0A
 impo
@@ -846,16 +846,16 @@
 Before;%0A
+
 import o
@@ -1511,64 +1511,8 @@
 r;%0A%0A
-import javax.inject.Inject;%0Aimport javax.inject.Named;%0A%0A
 publ
@@ -1801,16 +1801,87 @@
 atiet;%0A%0A
+    private EntityReferenceResolver%3CEntityReference%3E currentResolver;%0A%0A
     priv
@@ -2093,79 +2093,8 @@
 s;%0A%0A
-    private EntityReferenceResolver%3CEntityReference%3E currentResolver;%0A%0A
     
@@ -2304,17 +2304,431 @@
 G, %22
-explicit%22
+current%22);%0A        this.logger = this.mocker.getInstance(Logger.class);%0A        this.repository = this.mocker.getInstance(PatientRepository.class);%0A        this.factory = this.mocker.getInstance(DomainObjectFactory.class);%0A        this.qm = this.mocker.getInstance(QueryManager.class);%0A        this.access = this.mocker.getInstance(AuthorizationManager.class);%0A        this.users = this.mocker.getInstance(UserManager.class
 );%0A 

Set up getting instances of injected classes