liujie
2026-01-14 f976a39b294f8c7dd60bcd2c661983c0dcc97fc6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.estate.expert.admin.service.model;
 
import com.estate.expert.admin.domain.standard.model.device.DeviceModel;
import com.estate.expert.admin.domain.standard.model.device.DeviceModelDto;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.transaction.annotation.Transactional;
 
import static org.junit.jupiter.api.Assertions.*;
 
@Slf4j
@SpringBootTest
@ExtendWith(SpringExtension.class)
@Transactional
class DeviceModelServiceTest {
 
    @Autowired
    private DeviceModelService deviceModelService;
 
 
    private DeviceModel deviceModel;
 
    @BeforeEach
    void add() {
        var dto = DeviceModelDto.builder()
                .name("test")
                .build();
        deviceModel = deviceModelService.add(null, dto);
        assertNotNull(deviceModel);
    }
 
    @Test
    void copy() {
        var newModel = deviceModelService.copy(null, deviceModel.getId());
        assertNotNull(newModel);
    }
 
}