I am writing the below code using Contentstack Management SDK, and when I am writing the unit tests using Mockito framework, not able to Mock the entry.create(prodRequest).execute().
Appreciate if we could get some assistance on this please, (basically how to mock the retrofit2). Here is the code snippet.
import com.contentstack.cms.Contentstack;
import com.contentstack.cms.stack.Entry;
import com.contentstack.cms.stack.Stack;
import retrofit2.Response;
Contentstack contentstack = new Contentstack.Builder().build();
Stack stack = contentstack.stack(stackApiKey, managementToken);
Entry entry = stack.contentType(contentType).entry();
try {
Response responseFromCs = entry.create(prodRequest).execute();
if (responseFromCs.isSuccessful()) {
}
Best answer by lalatendu
View original