lundi 1 juillet 2019

i want to test static method in class with mockito

i want to test static method in class with mockito iam begainer in android testing iam adding mockito dependancy

public class UrlHelper {
    private static String TAG = UrlHelper.class.getSimpleName();

    protected static String buildURL(String url, boolean isRelativeUrl) {
        String requestUrl = "";
        if (url != null && !url.isEmpty()) {
            Log.d(TAG, "url is not null or empty");
            requestUrl = url;
        }

        if (isRelativeUrl) {
            Log.d(TAG, "url is relative url");
            requestUrl = Constants.BASE_URL + url;
        }
        return requestUrl;
    }
}

Aucun commentaire:

Enregistrer un commentaire