| | |
| | | @Mock |
| | | private TBatteryGroupMapper batteryGroupMapper; |
| | | |
| | | @Test |
| | | void listShouldIncludeSharedFieldValues() |
| | | { |
| | | TBatteryGroup group = new TBatteryGroup(); |
| | | group.setGroupId(12L); |
| | | TBatteryGroupRelationField relation = new TBatteryGroupRelationField(); |
| | | relation.setBatteryGroupFieldId(7L); |
| | | relation.setFieldName("额定容量"); |
| | | relation.setFieldValue("72"); |
| | | when(batteryGroupMapper.selectBatteryGroupList(any(TBatteryGroup.class))).thenReturn(Collections.singletonList(group)); |
| | | when(batteryGroupMapper.selectRelationFields(12L)).thenReturn(Collections.singletonList(relation)); |
| | | |
| | | List<TBatteryGroup> result = batteryGroupService.selectBatteryGroupList(new TBatteryGroup()); |
| | | |
| | | assertEquals("额定容量", result.get(0).getTemplateFields().get(0).getFieldName()); |
| | | assertEquals("72", result.get(0).getTemplateFields().get(0).getFieldValue()); |
| | | } |
| | | |
| | | @InjectMocks |
| | | private TBatteryGroupServiceImpl batteryGroupService; |
| | | |