我使用Retrofit为我的REST API实现了Java客户端。客户端是一个简单的Java应用程序,而不是一个Android应用程序。我如何为我的Java客户端编写单元测试?以下是我的服务班之一。如何测试使用Retrofit实现的REST客户端
public interface CountryService {
/**
* Returns country list.
*
* @param sortby
* Optional; Sorting order of list. Pass null to ignore.
*
* @return Countries object with list of countries.
*
* @throws SRSRetrofitException
*/
@GET(SRSClientConstants.SLASH + SRSClientConstants.RESOURCE_COUNTRY)
public Countries getCountries(@Query("sortby") String sortby)
throws SRSRetrofitException;
}
这看起来像[此问题]的副本(http://stackoverflow.com/q/17544751/515948)。 –
我最终实现了这个问题的答案。 – TechCrunch