test(aihr): cover disabled scenario rejection
This commit is contained in:
+14
@@ -234,6 +234,20 @@ public class AihrPracticeSeedServiceTest {
|
|||||||
assertTrue(source.contains("训练场景已停用,无法开始"));
|
assertTrue(source.contains("训练场景已停用,无法开始"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void startRejectsDisabledDatabaseScenario() {
|
||||||
|
JdbcTemplate jdbcTemplate = mock(JdbcTemplate.class);
|
||||||
|
when(jdbcTemplate.query(contains("SELECT enabled"), any(RowMapper.class), eq("000000"), eq("disabled-scene")))
|
||||||
|
.thenAnswer(invocation -> mapOne(invocation, Map.of("enabled", "false")));
|
||||||
|
AihrPracticeSeedService service = new AihrPracticeSeedService(new ObjectMapper(), jdbcTemplate, null, null);
|
||||||
|
|
||||||
|
ServiceException error = assertThrows(ServiceException.class, () -> service.start(
|
||||||
|
new StartRequest("employee-a", "disabled-scene", "text", null)
|
||||||
|
));
|
||||||
|
|
||||||
|
assertEquals("训练场景已停用,无法开始", error.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createAssignmentRejectsOutOfProjectAssignee() {
|
public void createAssignmentRejectsOutOfProjectAssignee() {
|
||||||
JdbcTemplate jdbcTemplate = mock(JdbcTemplate.class);
|
JdbcTemplate jdbcTemplate = mock(JdbcTemplate.class);
|
||||||
|
|||||||
Reference in New Issue
Block a user