use of io.gravitee.repository.management.model.Category.AuditEvent.CATEGORY_CREATED in project gravitee-management-rest-api by gravitee-io.
the class CategoryService_CreateTest method shouldCreateCategory.
@Test
public void shouldCreateCategory() throws TechnicalException {
NewCategoryEntity v1 = new NewCategoryEntity();
v1.setName("v1");
when(mockCategoryRepository.create(argThat(cat -> cat.getCreatedAt() != null))).thenReturn(new Category());
when(mockEnvironmentService.findById("DEFAULT")).thenReturn(new EnvironmentEntity());
CategoryEntity category = categoryService.create(v1);
assertNotNull("result is null", category);
verify(mockAuditService, times(1)).createEnvironmentAuditLog(any(), eq(CATEGORY_CREATED), any(), isNull(), any());
verify(mockCategoryRepository, times(1)).create(argThat(arg -> arg != null && arg.getName().equals("v1")));
}
Aggregations