activiti with spring security example (#2909)

This commit is contained in:
lor6
2017-11-04 15:43:29 +02:00
committed by Grzegorz Piwowarek
parent bc899ef38f
commit 8e04a06bc9
15 changed files with 581 additions and 1 deletions
@@ -0,0 +1,31 @@
package com.example.activitiwithspring;
import org.activiti.engine.IdentityService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import com.baeldung.activiti.security.withspring.ActivitiSpringSecurityApplication;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = ActivitiSpringSecurityApplication.class)
@WebAppConfiguration
public class ActivitiSpringSecurityIntegrationTest {
@Autowired
private IdentityService identityService;
@Test
public void whenUserExists_thenOk() {
identityService.setUserPicture("spring_user", null);
}
@Test(expected = UsernameNotFoundException.class)
public void whenUserNonExistent_thenSpringException() {
identityService.setUserPicture("user3", null);
}
}