I'm trying to print something when running Android Local Unit Test, but nothing's happening. What's the matter? How can I fix it?
I consulted some documents on http://developer.android.com, found that Android Local Unit Test just run on my machine's JVM, the android.jar file that is used to run unit tests does not contain any actual code, so Log.d() print nothing. If i wanna print log, how can i do?
Here is my code, FeedbackModelTest.java located in src/test/main directory.
package com.upward.reader.mvp.model;
import android.util.Log;
import com.upward.reader.mvp.bean.FeedbackBean;
import com.upward.reader.net.RequestJSONCallback;
import org.junit.Test;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class FeedbackModelTest {
@Test
public void postFeedback() throws Exception {
final String url = "http://test.guguread.com/interface/app/user/feedback?";
Map<String, String> params = new HashMap<>();
params.put("content", "content");
new FeedbackModel().postFeedback(url, params, new RequestJSONCallback<FeedbackBean>() {
@Override
public void onResponse(FeedbackBean result) throws IOException {
Log.d("TAG", result.toString());
}
@Override
public void onFailure(Exception e) {
e.printStackTrace();
}
});
}
}