-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExploitDTOTest.java
More file actions
62 lines (54 loc) · 2.57 KB
/
ExploitDTOTest.java
File metadata and controls
62 lines (54 loc) · 2.57 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
package org.nvip.api.serializers;
import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertEquals;
public class ExploitDTOTest {
@Test
public void testGettersAndSetters() {
ExploitDTO exploitDTO = new ExploitDTO(0,"old name","old description", "old example_file","old author","old date_published",false,"old source","old dateCreated",false,"0","old sourceURL");
exploitDTO.setExploitId(1);
exploitDTO.setName("new name");
exploitDTO.setDescription("new description");
exploitDTO.setExample_file("new example_file");
exploitDTO.setAuthor("new author");
exploitDTO.setDatePublished("new date_published");
exploitDTO.setSource("new source");
exploitDTO.setDateCreated("new dateCreated");
exploitDTO.setDownloadFailed(true);
exploitDTO.setCveId("1");
exploitDTO.setSourceUrl("new SourceUrl");
assertEquals(1, exploitDTO.getExploitId());
assertEquals("new name", exploitDTO.getName());
assertEquals("new description", exploitDTO.getDescription());
assertEquals("new example_file", exploitDTO.getExample_file());
assertEquals("new author", exploitDTO.getAuthor());
assertEquals("new date_published", exploitDTO.getDatePublished());
assertEquals("1", exploitDTO.getCveId());
assertEquals("new source", exploitDTO.getSource());
assertEquals("new SourceUrl", exploitDTO.getSourceUrl());
}
@Test
public void testBuilder() {
ExploitDTO exploitDTO = ExploitDTO.builder()
.exploitId(1)
.name("new name")
.description("new description")
.example_file("new example_file")
.author("new author")
.datePublished("new date_published")
.source("new source")
.dateCreated("new dateCreated")
.downloadFailed(true)
.cveId("1")
.sourceUrl("new SourceUrl")
.build();
assertEquals(1, exploitDTO.getExploitId());
assertEquals("new name", exploitDTO.getName());
assertEquals("new description", exploitDTO.getDescription());
assertEquals("new example_file", exploitDTO.getExample_file());
assertEquals("new author", exploitDTO.getAuthor());
assertEquals("new date_published", exploitDTO.getDatePublished());
assertEquals("1", exploitDTO.getCveId());
assertEquals("new source", exploitDTO.getSource());
assertEquals("new SourceUrl", exploitDTO.getSourceUrl());
}
}