I have a bean in scope request that generate a unique UUID for each request. I want to write a test that verify that 2 requests have different UUID.
How can I run 2 request in the same test to compare there UUID ?
I already have a test that verify that the UUID is the same everywhere during one request.
public class RequestUUIDTests {
@Autowired
WebApplicationContext wac;
@Autowired
MockHttpServletRequest request;
@Autowired
RequestUUID requestUUID;
@Test
public void testRequestUUID() throws Exception {
Assert.isTrue(requestUUID.toString().equals(request.getAttribute("scopedTarget.requestUUID").toString()));
Assert.isTrue(requestUUID.toString().equals(wac.getBean("requestUUID", RequestUUID.class).toString()));
}
}
If I run this test twice, I can see that the UUID is not the same. How can I test this automatically ?
Aucun commentaire:
Enregistrer un commentaire