yeg
2026-08-27 656cdaf4463b41a168adb83ccc05d8c2f03d4d78
ruoyi-admin/src/test/java/com/ruoyi/system/service/impl/TTestServiceImplTest.java
@@ -84,6 +84,26 @@
    }
    @Test
    void createShouldAllowPlanStepsToBeConfiguredLater()
    {
        TTest test = validTest();
        test.setPlanSteps(Collections.emptyList());
        mockEnabledOptions();
        when(testMapper.insertTest(any(TTest.class))).thenAnswer(invocation -> {
            invocation.<TTest>getArgument(0).setTestId(10L);
            return 1;
        });
        doAnswer(invocation -> {
            invocation.<TTestBattery>getArgument(0).setRelationId(20L);
            return 1;
        }).when(testMapper).insertTestBattery(any(TTestBattery.class));
        assertEquals(10L, testService.createTest(test));
        verify(testMapper, never()).insertTestPlanStep(any(TTestPlanStep.class));
    }
    @Test
    void createShouldRejectBatteryOutsideSelectedGroup()
    {
        TTest test = validTest();