-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
Copy pathUnitOfMeasureToUnitOfMeasureCommandTest.java
50 lines (38 loc) · 1.29 KB
/
UnitOfMeasureToUnitOfMeasureCommandTest.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.*;
/**
* Created by jt on 6/21/17.
*/
public class UnitOfMeasureToUnitOfMeasureCommandTest {
public static final String DESCRIPTION = "description";
public static final Long LONG_VALUE = new Long(1L);
UnitOfMeasureToUnitOfMeasureCommand converter;
@BeforeEach
public void setUp() throws Exception {
converter = new UnitOfMeasureToUnitOfMeasureCommand();
}
@Test
public void testNullObjectConvert() throws Exception {
assertNull(converter.convert(null));
}
@Test
public void testEmptyObj() throws Exception {
assertNotNull(converter.convert(new UnitOfMeasure()));
}
@Test
public void convert() throws Exception {
//given
UnitOfMeasure uom = new UnitOfMeasure();
uom.setId(LONG_VALUE);
uom.setDescription(DESCRIPTION);
//when
UnitOfMeasureCommand uomc = converter.convert(uom);
//then
assertEquals(LONG_VALUE, uomc.getId());
assertEquals(DESCRIPTION, uomc.getDescription());
}
}