add @Qualifier to web package tests

This commit is contained in:
Vitaliy Fedoriv 2016-11-09 21:40:05 +02:00
parent d2ed818034
commit 3e41bdf347
5 changed files with 10 additions and 0 deletions

View file

@ -5,6 +5,7 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.samples.petclinic.model.Owner; import org.springframework.samples.petclinic.model.Owner;
import org.springframework.samples.petclinic.service.ClinicService; import org.springframework.samples.petclinic.service.ClinicService;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
@ -36,6 +37,7 @@ public class OwnerControllerTests {
private OwnerController ownerController; private OwnerController ownerController;
@Autowired @Autowired
@Qualifier("ClinicService")
private ClinicService clinicService; private ClinicService clinicService;
private MockMvc mockMvc; private MockMvc mockMvc;

View file

@ -5,6 +5,7 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.format.support.FormattingConversionServiceFactoryBean; import org.springframework.format.support.FormattingConversionServiceFactoryBean;
import org.springframework.samples.petclinic.model.Owner; import org.springframework.samples.petclinic.model.Owner;
import org.springframework.samples.petclinic.model.Pet; import org.springframework.samples.petclinic.model.Pet;
@ -41,6 +42,7 @@ public class PetControllerTests {
private FormattingConversionServiceFactoryBean formattingConversionServiceFactoryBean; private FormattingConversionServiceFactoryBean formattingConversionServiceFactoryBean;
@Autowired @Autowired
@Qualifier("ClinicService")
private ClinicService clinicService; private ClinicService clinicService;
private MockMvc mockMvc; private MockMvc mockMvc;

View file

@ -6,6 +6,7 @@ import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.samples.petclinic.model.PetType; import org.springframework.samples.petclinic.model.PetType;
import org.springframework.samples.petclinic.service.ClinicService; import org.springframework.samples.petclinic.service.ClinicService;
@ -23,6 +24,7 @@ import static org.junit.Assert.assertEquals;
public class PetTypeFormatterTests { public class PetTypeFormatterTests {
@Mock @Mock
@Qualifier("ClinicService")
private ClinicService clinicService; private ClinicService clinicService;
private PetTypeFormatter petTypeFormatter; private PetTypeFormatter petTypeFormatter;

View file

@ -5,6 +5,7 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.samples.petclinic.model.Specialty; import org.springframework.samples.petclinic.model.Specialty;
import org.springframework.samples.petclinic.model.Vet; import org.springframework.samples.petclinic.model.Vet;
@ -33,6 +34,7 @@ public class VetControllerTests {
private VetController vetController; private VetController vetController;
@Autowired @Autowired
@Qualifier("ClinicService")
private ClinicService clinicService; private ClinicService clinicService;
private MockMvc mockMvc; private MockMvc mockMvc;

View file

@ -4,6 +4,7 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.samples.petclinic.model.Pet; import org.springframework.samples.petclinic.model.Pet;
import org.springframework.samples.petclinic.service.ClinicService; import org.springframework.samples.petclinic.service.ClinicService;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
@ -33,6 +34,7 @@ public class VisitControllerTests {
private VisitController visitController; private VisitController visitController;
@Autowired @Autowired
@Qualifier("ClinicService")
private ClinicService clinicService; private ClinicService clinicService;
private MockMvc mockMvc; private MockMvc mockMvc;