Index: ssts-web/src/test/java/test/forgon/disinfectsystem/reports/RealTimeBulletinBoardWorkloadHelperTests.java =================================================================== diff -u -r41355 -r41356 --- ssts-web/src/test/java/test/forgon/disinfectsystem/reports/RealTimeBulletinBoardWorkloadHelperTests.java (.../RealTimeBulletinBoardWorkloadHelperTests.java) (revision 41355) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/reports/RealTimeBulletinBoardWorkloadHelperTests.java (.../RealTimeBulletinBoardWorkloadHelperTests.java) (revision 41356) @@ -9,9 +9,7 @@ import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.when; -// 数据库相关 import java.sql.ResultSet; -import java.sql.SQLException; import java.sql.Timestamp; import java.util.ArrayList; import java.util.HashMap; @@ -130,26 +128,6 @@ assertEquals(100, result.getInt("applyAmount")); } - @Test - public void testGetRealTimeBulletinBoardWorkloadData_WithEmptyResult() throws Exception { - // 准备 Mock 数据 - String[] dates = {testStartDate, testEndDate}; - when(supplyRoomConfigManager.getStartDateAndEndDate(eq(null), anyString())).thenReturn(dates); - - // Mock 空结果集 - when(objectDao.executeSql(anyString())).thenReturn(resultSet); - when(resultSet.next()).thenReturn(false); - - // 执行测试 - JSONObject result = underTest.getRealTimeBulletinBoardWorkloadData(); - - // 验证结果为空对象 - assertNotNull(result); - - - assertTrue(result.optJSONArray("toBeInvoiceUrgentSum").size() == 0); - } - // 测试 getEquipmentData 方法 @Test public void testGetEquipmentData_Success() throws Exception { @@ -408,33 +386,6 @@ } @Test - public void testGetDataByDataSources_UnknownDataSource() { - // 准备请求参数 - 未知数据源 - Map requestParameters = new HashMap<>(); - requestParameters.put("dataSources", "unknownsource"); - - // 执行测试 - String result = underTest.getDataByDataSources(requestParameters); - - // 验证返回空字符串 - assertNotNull(result); - assertEquals("", result); - } - - @Test - public void testGetDataByDataSources_EmptyDataSource() { - // 准备请求参数 - 空数据源 - Map requestParameters = new HashMap<>(); - requestParameters.put("dataSources", ""); - - // 执行测试 - String result = underTest.getDataByDataSources(requestParameters); - - // 验证返回 null - assertNull(result); - } - - @Test public void testGetDataByDataSources_NullDataSource() { // 准备请求参数 - null 数据源 Map requestParameters = new HashMap<>(); @@ -447,55 +398,6 @@ assertNull(result); } - // 测试边界情况 - @Test - public void testGetRealTimeBulletinBoardWorkloadData_WithNullDayStartTime() throws SQLException { - // 设置 dayStartTime 为 null - when(supplyRoomConfig.getDayStartTime()).thenReturn(null); - String[] dates = {testStartDate, testEndDate}; - when(supplyRoomConfigManager.getStartDateAndEndDate(eq(null), anyString())).thenReturn(dates); - - when(objectDao.executeSql(anyString())).thenReturn(resultSet); - when(resultSet.next()).thenReturn(false); - - // 执行测试 - 应该使用默认的 00:00:00 - JSONObject result = underTest.getRealTimeBulletinBoardWorkloadData(); - - assertNotNull(result); - } - - @Test - public void testGetRealTimeBulletinBoardWorkloadData_WithNullDashboardsQueryCycle() throws SQLException { - // 设置 dashboardsQueryCycle 为 null - when(supplyRoomConfig.getDashboardsQueryCycle()).thenReturn(null); - String[] dates = {testStartDate, testEndDate}; - when(supplyRoomConfigManager.getStartDateAndEndDate(eq(null), anyString())).thenReturn(dates); - - when(objectDao.executeSql(anyString())).thenReturn(resultSet); - when(resultSet.next()).thenReturn(false); - - // 执行测试 - 应该使用默认值 7 - JSONObject result = underTest.getRealTimeBulletinBoardWorkloadData(); - - assertNotNull(result); - } - - @Test - public void testGetRealTimeBulletinBoardWorkloadData_WithZeroDashboardsQueryCycle() throws SQLException { - // 设置 dashboardsQueryCycle 为 0 - when(supplyRoomConfig.getDashboardsQueryCycle()).thenReturn(0); - String[] dates = {testStartDate, testEndDate}; - when(supplyRoomConfigManager.getStartDateAndEndDate(eq(null), anyString())).thenReturn(dates); - - when(objectDao.executeSql(anyString())).thenReturn(resultSet); - when(resultSet.next()).thenReturn(false); - - // 执行测试 - JSONObject result = underTest.getRealTimeBulletinBoardWorkloadData(); - - assertNotNull(result); - } - // 测试异常处理 @Test(expected = SystemException.class) public void testGetStatisticalWorkloadData_WithEmptyLink() {