use of com.khmelenko.lab.varis.task.TaskException 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.TaskException 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.TaskException 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.TaskException 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());
}
use of com.khmelenko.lab.varis.task.TaskException in project Varis-Android by dkhmelenko.
the class TestRepoDetailsPresenter method testLoadBuildsHistoryFailed.
@Test
public void testLoadBuildsHistoryFailed() {
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().getBuilds(slug)).thenThrow(exception);
mRepoDetailsPresenter.setRepoSlug(slug);
mRepoDetailsPresenter.loadBuildsHistory();
verify(mTaskManager).getBuildHistory(slug);
verify(mRepoDetailsView).showBuildHistoryLoadingError(error.getMessage());
}
Aggregations