-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPatchCommitDTOTest.java
61 lines (50 loc) · 2.64 KB
/
PatchCommitDTOTest.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
51
52
53
54
55
56
57
58
59
60
61
package org.nvip.api.serializers;
import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertEquals;
public class PatchCommitDTOTest {
@Test
public void testGettersAndSetters() {
PatchCommitDTO patchCommitDTO = new PatchCommitDTO("old cveid","old name","old commitSha", "old commitMessage","old uniDiff","old timeline","old timeToPatch","old commitDate",0);
patchCommitDTO.setCveId("new cveid");
patchCommitDTO.setSourceUrl("new SourceUrl");
patchCommitDTO.setCommitSha("new commitSha");
patchCommitDTO.setCommitMessage("new commitMessage");
patchCommitDTO.setUniDiff("new UniDiff");
patchCommitDTO.setTimeline("new Timeline");
patchCommitDTO.setTimeToPatch("new timeToPatch");
patchCommitDTO.setCommitDate("new CommitDate");
patchCommitDTO.setLinesChanged(1);
assertEquals("new cveid",patchCommitDTO.getCveId());
assertEquals("new SourceUrl",patchCommitDTO.getSourceUrl());
assertEquals("new commitSha",patchCommitDTO.getCommitSha());
assertEquals("new commitMessage",patchCommitDTO.getCommitMessage());
assertEquals("new UniDiff",patchCommitDTO.getUniDiff());
assertEquals("new Timeline",patchCommitDTO.getTimeline());
assertEquals("new timeToPatch",patchCommitDTO.getTimeToPatch());
assertEquals("new CommitDate",patchCommitDTO.getCommitDate());
assertEquals(1,patchCommitDTO.getLinesChanged());
}
@Test
public void testBuilder() {
PatchCommitDTO patchCommitDTO = PatchCommitDTO.builder()
.cveId("new cveid")
.sourceUrl("new SourceUrl")
.commitSha("new commitSha")
.commitMessage("new commitMessage")
.uniDiff("new UniDiff")
.timeline("new Timeline")
.timeToPatch("new timeToPatch")
.commitDate("new CommitDate")
.linesChanged(1)
.build();
assertEquals("new cveid",patchCommitDTO.getCveId());
assertEquals("new SourceUrl",patchCommitDTO.getSourceUrl());
assertEquals("new commitSha",patchCommitDTO.getCommitSha());
assertEquals("new commitMessage",patchCommitDTO.getCommitMessage());
assertEquals("new UniDiff",patchCommitDTO.getUniDiff());
assertEquals("new Timeline",patchCommitDTO.getTimeline());
assertEquals("new timeToPatch",patchCommitDTO.getTimeToPatch());
assertEquals("new CommitDate",patchCommitDTO.getCommitDate());
assertEquals(1,patchCommitDTO.getLinesChanged());
}
}