????????????????
???????????? ???????[ 2013/5/20 11:29:10 ] ????????
????????????????????post??put??????????????????Moco??????£????????????????????????????????????????HTTP????????????λ??localhost??Moco?????????????????????????????GET/POST/PUT??????????????????????
????Moco?????????
??????ThoughtWorks?????????????????????????????????á???????????????????????????????????COBOL???????????У??????????????????????д??????????????????????鷢??????????????????????????????????????????????????????????????????λ???????????Moco??????????????????????
?????????????????????API??????????????????Moco????API??????Moco?????standalone????????????????????????????????????????????λ?????“foo.json”??????У????????????????HTTP????????
[
{
"response" : {
"text" : "Hello?? Moco"
}
}
]
?????????????????????????
java -jar moco-runner-<version>-standalone.jar -p 12306 foo.json
?????????“http://localhost:12306”?????????URL????????“Hello?? Moco”????????????????????????????????????????????????????????????????????????
??????л??????????????????????????Garrett Heel??Moco?????????Maven???????????????????????????????????Moco??????????????????Cucumber????????????Moco????????????????????????????????????Moco?????????????С?
??????Moco?????ThoughtWorks????????????????????????????Щ???????????????????????????????????????????????????????????????????????飬???????????????????????????
????????????????
???????????????????????????????????????????????????????????????????????????????????????????е??????????????????????????????????????????????????????????????Ч???????????????????????????????????????????ɡ?
??????????????????????????????????????façade????IdentityService?????в???????????IdentityService??????????mock[7]????????XmlEndPoint?????????“????????????”???????
xmlEndPoint = mock(XmlEndPoint.class);
identityService = new IdentityServiceImpl(xmlEndPoint);
??????????????mock??XmlEndPoint???????????????????????????IdentityService?????????????????????????Щ????????????????????????“???????”?????XmlEndPoint?????????????OpenPTK????????????????
????1??????????HTTP?????“200 FOUND”??????????????????????XML??
????2????????????HTTP?????“204 NO CONTENT”?????????????
????????????“??????”????????????mock??XmlEndPoint????????????????????get??????????????????????HTTP??????????з??????200???????????????????XML??
when(xmlEndPoint.get(anyString())).thenReturn(
new XmlEndPointResponse(STATUS_SUCCESS?? userFoundResponse));
??????mock??XmlEndPoint????????????????????“???????”???????????????????????????????????
Customer customer = identityService.findByEmail("gigix1980@gmail.com");
assertThat(customer.getFirstName()?? equalTo("Jeff"));
assertThat(customer.getLastName()?? equalTo("Xiong"));
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11