Skip to content
Snippets Groups Projects
Commit 2aaa1567 authored by Christoph Thelen's avatar Christoph Thelen Committed by Daniel Gerhardt
Browse files

Revert additional profile, add global Mock for EntityService<DummyEntity>

Two key changes:

  1. Add a factory method to create the EntityService with the
     DummyEntity, so that all other test cases can initialize
     this Bean.  This solves the IllegalStateException reported
     in this ticket.
  2. Use @Autowire instead of @MockBean to use the new factory
     method.  That resolves the known issue that the caching test
     case does not work because of different RoomRepositories being
     created for the PermissionEvaluatorAdvice and the EntityService.

This makes all tests runnable again.  My current theory is that due to
the fact that we have at least two EntityServices (one created by
the DefaultEntityServiceImplTest, and now one by this test).  The
@MockBean annotation could be throwing out the previous EntityService,
since according to documentation, it replaces existing Beans with the
same type.  This could lead to a situation where, initially, the
PermissionEvaluatorAdvice and the DefaultEntityService share the same
RoomRepository.  But after the @MockBean replacement occurs, the
EntityService is recreated with a different RoomRepository, while the
Advice keeps its initial RoomRepository, leading to testing failures
in the testCaching test case.
parent 66cc0201
1 merge request!129Add tests for JsonViewControllerAdvice
Pipeline #26827 passed with warnings with stages
in 1 minute and 23 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment