2
2
3
3
import org .junit .Test ;
4
4
5
+ import java .util .Arrays ;
5
6
import java .util .Collections ;
6
7
7
8
import static org .junit .Assert .*;
@@ -31,6 +32,15 @@ public void ingoreMissingDescription() throws Exception {
31
32
assertEquals (Collections .singletonList (new FileField .ParsedFileField ("" , "wei2005ahp.pdf" , "PDF" )), FileField .parse (input ));
32
33
}
33
34
35
+ @ Test
36
+ public void interpreteLinkAsOnlyMandatoryField () throws Exception {
37
+ String single = "wei2005ahp.pdf" ;
38
+ String multiple = "wei2005ahp.pdf;other.pdf" ;
39
+
40
+ assertEquals (Collections .singletonList (new FileField .ParsedFileField ("" , "wei2005ahp.pdf" , "" )), FileField .parse (single ));
41
+ assertEquals (Arrays .asList (new FileField .ParsedFileField ("" , "wei2005ahp.pdf" , "" ), new FileField .ParsedFileField ("" , "other.pdf" , "" )), FileField .parse (multiple ));
42
+ }
43
+
34
44
@ Test
35
45
public void escapedCharactersInDescription () throws Exception {
36
46
String input = "test\\ :\\ ;:wei2005ahp.pdf:PDF" ;
@@ -53,10 +63,14 @@ public void handleEscapedFilePath() throws Exception {
53
63
}
54
64
55
65
@ Test
56
- public void tooLessSeparators () throws Exception {
57
- String input = "desc:" ;
58
-
59
- assertEquals (Collections .singletonList (new FileField .ParsedFileField ("desc" , "" , "" )), FileField .parse (input ));
66
+ public void subsetOfFieldsResultsInFileLink () throws Exception {
67
+ String descOnly = "file.pdf::" ;
68
+ String fileOnly = ":file.pdf" ;
69
+ String typeOnly = "::file.pdf" ;
70
+
71
+ assertEquals (Collections .singletonList (new FileField .ParsedFileField ("" , "file.pdf" , "" )), FileField .parse (descOnly ));
72
+ assertEquals (Collections .singletonList (new FileField .ParsedFileField ("" , "file.pdf" , "" )), FileField .parse (fileOnly ));
73
+ assertEquals (Collections .singletonList (new FileField .ParsedFileField ("" , "file.pdf" , "" )), FileField .parse (typeOnly ));
60
74
}
61
75
62
76
@ Test
0 commit comments