use of io.gravitee.repository.management.model.QualityRule in project gravitee-management-rest-api by gravitee-io.
the class QualityRuleServiceTest method shouldNotFindById.
@Test(expected = QualityRuleNotFoundException.class)
public void shouldNotFindById() throws TechnicalException {
final QualityRule qualityRule = mock(QualityRule.class);
when(qualityRuleRepository.findById(QUALITY_RULE_ID)).thenReturn(empty());
qualityRuleService.findById(QUALITY_RULE_ID);
}
use of io.gravitee.repository.management.model.QualityRule in project gravitee-management-rest-api by gravitee-io.
the class QualityRuleServiceTest method shouldFindById.
@Test
public void shouldFindById() throws TechnicalException {
final QualityRule qualityRule = mock(QualityRule.class);
when(qualityRule.getId()).thenReturn(QUALITY_RULE_ID);
when(qualityRule.getName()).thenReturn("NAME");
when(qualityRule.getDescription()).thenReturn("DESC");
when(qualityRule.getWeight()).thenReturn(1);
when(qualityRule.getCreatedAt()).thenReturn(new Date(1));
when(qualityRule.getUpdatedAt()).thenReturn(new Date(2));
when(qualityRuleRepository.findById(QUALITY_RULE_ID)).thenReturn(of(qualityRule));
final QualityRuleEntity qualityRuleEntity = qualityRuleService.findById(QUALITY_RULE_ID);
assertEquals(QUALITY_RULE_ID, qualityRuleEntity.getId());
assertEquals("NAME", qualityRuleEntity.getName());
assertEquals("DESC", qualityRuleEntity.getDescription());
assertEquals(1, qualityRuleEntity.getWeight());
assertEquals(new Date(1), qualityRuleEntity.getCreatedAt());
assertEquals(new Date(2), qualityRuleEntity.getUpdatedAt());
}
Aggregations