???????????????
????????????????controller??????????????????????????????????????????????в?????
????1 @RunWith(SpringJUnit4ClassRunner.class)
????2 @ContextHierarchy({
????3    @ContextConfiguration("classpath:spring/business-config.xml")??
????4   @ContextConfiguration("classpath:spring/mvc-core-config.xml")
????5 })
????6 @WebAppConfiguration
????7 @ActiveProfiles("jdbc")
????8 public class PetControllerIT {
????9
????10    @Autowired
????11    private WebApplicationContext context;
????12
????13    @Test
????14    public void should_set_pet_types_in_model() throws Exception {
????15        MockMvc mockMvc = webAppContextSetup(context).build();
????16        RequestBuilder getNewPet = get("/owners/1/pets/new");
????17        mockMvc.perform(getNewPet)
????18            .andExpect(model().attributeExists("types"))
????19            .andExpect(request().sessionAttribute("pet"?? instanceOf(Pet.class)));
????20    }
????21 }??????????????????????????2?????
???????3?????4?У????????Spring????????????????????
???????16?У????????????ó???????????URL?????GET??????????????????
???????18?У???????????model???????а?????types???????
?????????19?У????????????а?????pet?????????????????????????????????????????Pet????
?????????instanceOf()??????????????Hamcrest API?????????
?????????Щ???????????
?????????????????????PetClinic???????Щ????????????????????????Hypersonic SQL????????????????????schema???????????Щ???????Щ????????????????????????????????????ó????У??????????????????????????????????ò????????????????????????в??????????г??????????????????????????л??????????????????????????????????п??????????????????????????????????н?????????????????
????????????????????????????PetController?е?initCreationForm()??????????????????????????????????processCreationForm()????????á?????????????г???????????????????????в?????????????????????в???????????????????????????????ζ???????????????????????ò??????????????????????????????????????????????????????????????????????????????????????????????JUnit????????????????????????????????????????
????????????????????????????????????????????FTP???????????д??????????????????????????????????????mock???????????????д????κμ??????????????????????м?鸴???JPA??????????????????mock???????????????????????????????????????????????????????????????????????????????????????????£?????????????????????????????????????????????й?????Щ??????????????
????????????????????????κ??????web??ó????У??????????????????????web service????????????????????????????????????????????ó???????????????web service??????????????ó?????????????????Э??????????????????????????Щweb service????????????????????????????????????????????????????????SOAP??REST????????
?????????????ó?????????????Spring??????Java EE???????????????????ò??????Java EE????????????????????CDI???????????????????autowiring???????????????ó?????ζ?????????????????????????????????????????????Java EE????????????ó??????????????????????÷???????????????ó?????????????????????????????????????????????????е????????????????????????г????????
????????
??????????У????????????????????Щ???????????????????????????????????????Spring MVC web???????????
???????????????????????д?????Щ???????????????????????????????????????????????
?????????е?????????Щ????????????????????о????????????????????????????????????Integration Testing from the Trenches????飬???????????????????????????????????????????Щ????????????????????????