use of com.atlassian.stash.i18n.KeyedMessage in project stashbot by palantir.
the class RepoConfigurationServletTest method postTestWhenLockedSrc.
@Test
public void postTestWhenLockedSrc() throws Exception {
when(jsc.getLocked()).thenReturn(true);
when(jsc2.getLocked()).thenReturn(false);
Exception permissionException = new AuthorisationException(new KeyedMessage("permission exceptionz", null, null));
Mockito.doThrow(permissionException).when(pvs).validateForGlobal(Permission.SYS_ADMIN);
when(req.getParameter("jenkinsServerName")).thenReturn("default2");
when(cpm.getRepositoryConfigurationForRepository(mockRepo)).thenReturn(rc);
rcs.doPost(req, res);
verify(res).sendError(Mockito.anyInt(), Mockito.anyString());
}
use of com.atlassian.stash.i18n.KeyedMessage in project stash-codesearch-plugin by palantir.
the class GlobalSettingsServletTest method getTestWhenNotSysAdmin.
@Test
public void getTestWhenNotSysAdmin() throws Exception {
Mockito.doThrow(new AuthorisationException(new KeyedMessage("testException", "testException", "testException"))).when(pvs).validateForGlobal(Permission.SYS_ADMIN);
servlet.doGet(req, res);
Mockito.verify(res).sendError(Mockito.eq(HttpServletResponse.SC_UNAUTHORIZED), Mockito.any(String.class));
Mockito.verify(res, Mockito.never()).getWriter();
}
Aggregations