-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
Copy pathNotesToNotesCommandTest.java
49 lines (38 loc) · 1.21 KB
/
NotesToNotesCommandTest.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
package guru.springframework.converters;
import guru.springframework.commands.NotesCommand;
import guru.springframework.domain.Notes;
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 NotesToNotesCommandTest {
public static final Long ID_VALUE = new Long(1L);
public static final String RECIPE_NOTES = "Notes";
NotesToNotesCommand converter;
@BeforeEach
public void setUp() throws Exception {
converter = new NotesToNotesCommand();
}
@Test
public void convert() throws Exception {
//given
Notes notes = new Notes();
notes.setId(ID_VALUE);
notes.setRecipeNotes(RECIPE_NOTES);
//when
NotesCommand notesCommand = converter.convert(notes);
//then
assertEquals(ID_VALUE, notesCommand.getId());
assertEquals(RECIPE_NOTES, notesCommand.getRecipeNotes());
}
@Test
public void testNull() throws Exception {
assertNull(converter.convert(null));
}
@Test
public void testEmptyObject() throws Exception {
assertNotNull(converter.convert(new Notes()));
}
}