【发布时间】:2015-09-06 19:05:54
【问题描述】:
我使用 Retrofit 为我的 REST API 实现了一个 Java 客户端。客户端是一个简单的 Java 应用程序,而不是 Android 应用程序。如何为我的 Java 客户端编写单元测试?以下是我的服务课程之一。
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;
}
【问题讨论】:
-
这看起来像是 this question 的副本。
-
我最终实现了该问题的答案。
标签: java unit-testing junit retrofit