@@ -0,0 +1,2662 @@
+package at.ac.tuwien.inso.method_security_tests;%0A%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.boot.test.context.SpringBootTest;%0Aimport org.springframework.security.access.AccessDeniedException;%0Aimport org.springframework.security.authentication.AuthenticationCredentialsNotFoundException;%0Aimport org.springframework.security.test.context.support.WithMockUser;%0Aimport org.springframework.test.context.ActiveProfiles;%0Aimport org.springframework.test.context.ContextConfiguration;%0Aimport org.springframework.test.context.junit4.SpringJUnit4ClassRunner;%0Aimport org.springframework.transaction.annotation.Transactional;%0A%0Aimport java.math.BigDecimal;%0A%0Aimport at.ac.tuwien.inso.entity.Subject;%0Aimport at.ac.tuwien.inso.service.SubjectService;%0A%0A@RunWith(SpringJUnit4ClassRunner.class)%0A@ContextConfiguration%0A@SpringBootTest%0A@ActiveProfiles(%22test%22)%0A@Transactional%0Apublic class SubjectServiceSecurityTests %7B%0A%0A    @Autowired%0A    private SubjectService subjectService;%0A%0A%0A    @Test(expected = AuthenticationCredentialsNotFoundException.class)%0A    public void createNotAuthenticated() %7B%0A        subjectService.create(new Subject());%0A    %7D%0A%0A    @Test(expected = AccessDeniedException.class)%0A    @WithMockUser(roles = %22STUDENT%22)%0A    public void createNotAuthenticatedAsStudent() %7B%0A        subjectService.create(new Subject());%0A    %7D%0A%0A    @Test(expected = AccessDeniedException.class)%0A    @WithMockUser(roles = %22LECTURER%22)%0A    public void createNotAuthenticatedAsLecturer() %7B%0A        subjectService.create(new Subject());%0A    %7D%0A%0A    @Test%0A    @WithMockUser(roles = %22ADMIN%22)%0A    public void createNotAuthenticatedAsAdmin() %7B%0A        subjectService.create(new Subject(%22ASE%22, BigDecimal.ONE));%0A    %7D%0A%0A    @Test(expected = AuthenticationCredentialsNotFoundException.class)%0A    public void findAllNotAuthenticated() %7B%0A        subjectService.findAll();%0A    %7D%0A%0A    @Test%0A    @WithMockUser%0A    public void findAllAuthenticated() %7B%0A        subjectService.findAll();%0A    %7D%0A%0A    @Test(expected = AuthenticationCredentialsNotFoundException.class)%0A    public void findOneNotAuthenticated() %7B%0A        subjectService.findOne(Long.valueOf(1));%0A    %7D%0A%0A    @Test%0A    @WithMockUser%0A    public void findOneAuthenticated() %7B%0A        subjectService.findOne(Long.valueOf(1));%0A    %7D%0A%0A    @Test(expected = AuthenticationCredentialsNotFoundException.class)%0A    public void searchForSubjectsNotAuthenticated() %7B%0A        subjectService.searchForSubjects(%22ASE%22);%0A    %7D%0A%0A    @Test%0A    @WithMockUser%0A    public void searchForSubjectsAuthenticated() %7B%0A        subjectService.searchForSubjects(%22ASE%22);%0A    %7D%0A%0A%7D%0A

Add tests for method security for SubjectService