-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Refactoring and addition of unit tests #7581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 20 commits
50e89ff
0ec8a52
9a3ec82
c01c3c3
14f149e
8add785
e4b183d
5c64b84
edab481
74f826b
0315466
7b4117c
6be0110
0c7467c
4053acd
c772b09
b47441c
a0bc8f9
80f48e2
2e1e956
8622db6
aebae90
5a142bf
ecdc372
3549ac7
9d9725e
6bfa64c
58232ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,14 +6,17 @@ | |||||||
| import org.jabref.model.pdf.FileAnnotation; | ||||||||
| import org.jabref.model.pdf.FileAnnotationType; | ||||||||
|
|
||||||||
| import org.junit.jupiter.api.BeforeEach; | ||||||||
| import org.junit.jupiter.api.Test; | ||||||||
|
|
||||||||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||||||||
| import static org.junit.jupiter.api.Assertions.assertTrue; | ||||||||
|
|
||||||||
| public class FileAnnotationViewModelTest { | ||||||||
|
|
||||||||
| @Test | ||||||||
| public void removeOnlyLineBreaksNotPrecededByPeriodOrColon() { | ||||||||
| private FileAnnotationViewModel annotationViewModel; | ||||||||
|
|
||||||||
| @BeforeEach | ||||||||
| void setup() { | ||||||||
| String content = "This is content"; | ||||||||
| String marking = String.format("This is paragraph 1.%n" + | ||||||||
| "This is paragr-%naph 2, and it crosses%nseveral lines,%nnow you can see next paragraph:%n" | ||||||||
|
|
@@ -22,16 +25,39 @@ public void removeOnlyLineBreaksNotPrecededByPeriodOrColon() { | |||||||
| FileAnnotation linkedFileAnnotation = new FileAnnotation("John", LocalDateTime.now(), 3, content, FileAnnotationType.FREETEXT, Optional.empty()); | ||||||||
| FileAnnotation annotation = new FileAnnotation("Jaroslav Kucha ˇr", LocalDateTime.parse("2017-07-20T10:11:30"), 1, marking, FileAnnotationType.HIGHLIGHT, Optional.of(linkedFileAnnotation)); | ||||||||
|
|
||||||||
| FileAnnotationViewModel annotationViewModel = new FileAnnotationViewModel(annotation); | ||||||||
| annotationViewModel = new FileAnnotationViewModel(annotation); | ||||||||
| } | ||||||||
|
|
||||||||
| @Test | ||||||||
| public void sameAuthor() { | ||||||||
| String expectedAuthor = "Jaroslav Kucha ˇr"; | ||||||||
| assertTrue(annotationViewModel.getAuthor().equals(expectedAuthor)); | ||||||||
|
||||||||
| } | ||||||||
|
|
||||||||
| @Test | ||||||||
| public void retrieveCorrectPageNumberAsString() { | ||||||||
| String expectedPage = "1"; | ||||||||
| assertTrue(annotationViewModel.getPage().equals(expectedPage)); | ||||||||
|
||||||||
| String expectedPage = "1"; | |
| assertTrue(annotationViewModel.getPage().equals(expectedPage)); | |
| assertEquals("1", annotationViewModel.getPage()); |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please create a one-liner like shown above.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please create a one-liner like shown above.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use assertEquals.
Uh oh!
There was an error while loading. Please reload this page.