-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
Copy pathUnitOfMeasureCommandToUnitOfMeasureTest.java
50 lines (36 loc) · 1.31 KB
/
UnitOfMeasureCommandToUnitOfMeasureTest.java
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
44
45
46
47
48
49
50
package guru.springframework.converters;
import guru.springframework.commands.UnitOfMeasureCommand;
import guru.springframework.domain.UnitOfMeasure;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
public class UnitOfMeasureCommandToUnitOfMeasureTest {
public static final String DESCRIPTION = "description";
public static final Long LONG_VALUE = new Long(1L);
UnitOfMeasureCommandToUnitOfMeasure converter;
@BeforeEach
public void setUp() throws Exception {
converter = new UnitOfMeasureCommandToUnitOfMeasure();
}
@Test
public void testNullParamter() throws Exception {
assertNull(converter.convert(null));
}
@Test
public void testEmptyObject() throws Exception {
assertNotNull(converter.convert(new UnitOfMeasureCommand()));
}
@Test
public void convert() throws Exception {
//given
UnitOfMeasureCommand command = new UnitOfMeasureCommand();
command.setId(LONG_VALUE);
command.setDescription(DESCRIPTION);
//when
UnitOfMeasure uom = converter.convert(command);
//then
assertNotNull(uom);
assertEquals(LONG_VALUE, uom.getId());
assertEquals(DESCRIPTION, uom.getDescription());
}
}