Remove redundant throws clauses

Removes exceptions that are declared in a method's signature but never thrown by the method itself or its implementations/derivatives.
This commit is contained in:
Lars Grefer
2019-08-23 01:03:54 +02:00
parent f0515a021c
commit 34dd5fea30
418 changed files with 1146 additions and 1273 deletions

View File

@@ -43,46 +43,46 @@ public class AspectJInterceptorTests {
private SecuredService securedService;
@Test
public void testPublicMethod() throws Exception {
public void testPublicMethod() {
service.publicMethod();
}
@Test(expected = AuthenticationCredentialsNotFoundException.class)
public void testSecuredMethodNotAuthenticated() throws Exception {
public void testSecuredMethodNotAuthenticated() {
service.secureMethod();
}
@Test(expected = AccessDeniedException.class)
public void testSecuredMethodWrongRole() throws Exception {
public void testSecuredMethodWrongRole() {
SecurityContextHolder.getContext().setAuthentication(admin);
service.secureMethod();
}
@Test
public void testSecuredMethodEverythingOk() throws Exception {
public void testSecuredMethodEverythingOk() {
SecurityContextHolder.getContext().setAuthentication(user);
service.secureMethod();
}
@Test(expected = AuthenticationCredentialsNotFoundException.class)
public void testSecuredClassNotAuthenticated() throws Exception {
public void testSecuredClassNotAuthenticated() {
securedService.secureMethod();
}
@Test(expected = AccessDeniedException.class)
public void testSecuredClassWrongRole() throws Exception {
public void testSecuredClassWrongRole() {
SecurityContextHolder.getContext().setAuthentication(admin);
securedService.secureMethod();
}
@Test(expected = AccessDeniedException.class)
public void testSecuredClassWrongRoleOnNewedInstance() throws Exception {
public void testSecuredClassWrongRoleOnNewedInstance() {
SecurityContextHolder.getContext().setAuthentication(admin);
new SecuredService().secureMethod();
}
@Test
public void testSecuredClassEverythingOk() throws Exception {
public void testSecuredClassEverythingOk() {
SecurityContextHolder.getContext().setAuthentication(user);
securedService.secureMethod();
new SecuredService().secureMethod();