use of com.khmelenko.lab.varis.task.TaskError in project Varis-Android by dkhmelenko.
the class TestBuildDetailsPresenter method testStartLoadingLogFailed.
@Test
public void testStartLoadingLogFailed() {
final long jobId = 1L;
final int errorCode = 401;
final String errorMsg = "error";
TaskError error = spy(new TaskError(errorCode, errorMsg));
Response response = new Response("url", 200, "", Collections.<Header>emptyList(), null);
error.setResponse(response);
TaskException exception = spy(new TaskException(error));
when(mRawClient.getApiService().getLog(String.valueOf(jobId))).thenThrow(exception);
mBuildsDetailsPresenter.startLoadingLog(jobId);
int loadLogInvocations = BuildsDetailsPresenter.LOAD_LOG_MAX_ATTEMPT + 1;
verify(mTaskManager, times(loadLogInvocations)).getLogUrl(jobId);
verify(mBuildDetailsView).showLoadingError(error.getMessage());
verify(mBuildDetailsView).showLogError();
}
use of com.khmelenko.lab.varis.task.TaskError in project Varis-Android by dkhmelenko.
the class TestBuildDetailsPresenter method testStartLoadingDataFailed.
@Test
public void testStartLoadingDataFailed() {
final long buildId = 1L;
final String slug = "test";
final int errorCode = 401;
final String errorMsg = "error";
TaskError error = spy(new TaskError(errorCode, errorMsg));
Response response = new Response("url", 200, "", Collections.<Header>emptyList(), null);
error.setResponse(response);
TaskException exception = spy(new TaskException(error));
when(mTravisRestClient.getApiService().getBuild(slug, buildId)).thenThrow(exception);
mBuildsDetailsPresenter.startLoadingData(null, slug, buildId);
verify(mTaskManager).getBuildDetails(slug, buildId);
verify(mBuildDetailsView).showProgress();
verify(mBuildDetailsView).hideProgress();
verify(mBuildDetailsView).updateBuildDetails(null);
verify(mBuildDetailsView).showLoadingError(error.getMessage());
}
use of com.khmelenko.lab.varis.task.TaskError in project Varis-Android by dkhmelenko.
the class TestBuildDetailsPresenter method testCancelBuildFailed.
@Test
public void testCancelBuildFailed() {
final int errorCode = 401;
final String errorMsg = "error";
TaskError error = spy(new TaskError(errorCode, errorMsg));
TaskException exception = spy(new TaskException(error));
when(mTravisRestClient.getApiService().cancelBuild(any(Long.class), any(TypedOutput.class))).thenThrow(exception);
mBuildsDetailsPresenter.cancelBuild();
verify(mTaskManager).getBuildDetails(any(String.class), any(Long.class));
verify(mBuildDetailsView, times(2)).showLoadingError(error.getMessage());
}
use of com.khmelenko.lab.varis.task.TaskError in project Varis-Android by dkhmelenko.
the class TestBuildDetailsPresenter method testRestartBuildFailed.
@Test
public void testRestartBuildFailed() {
final int errorCode = 401;
final String errorMsg = "error";
TaskError error = spy(new TaskError(errorCode, errorMsg));
TaskException exception = spy(new TaskException(error));
when(mTravisRestClient.getApiService().restartBuild(any(Long.class), any(TypedOutput.class))).thenThrow(exception);
mBuildsDetailsPresenter.restartBuild();
verify(mTaskManager).getBuildDetails(any(String.class), any(Long.class));
verify(mBuildDetailsView, times(2)).showLoadingError(error.getMessage());
}
use of com.khmelenko.lab.varis.task.TaskError in project Varis-Android by dkhmelenko.
the class TestRepoDetailsPresenter method testLoadRequestsFailed.
@Test
public void testLoadRequestsFailed() {
final String slug = "test";
final int errorCode = 401;
final String errorMsg = "error";
TaskError error = spy(new TaskError(errorCode, errorMsg));
TaskException exception = spy(new TaskException(error));
when(mTravisRestClient.getApiService().getRequests(slug)).thenThrow(exception);
mRepoDetailsPresenter.setRepoSlug(slug);
mRepoDetailsPresenter.loadRequests();
verify(mTaskManager).getRequests(slug);
verify(mRepoDetailsView).showPullRequestsLoadingError(error.getMessage());
}
Aggregations