@@ -32,23 +32,29 @@ import java.time.format.DateTimeFormatter
3232class ParseTest {
3333 @Test
3434 fun propfind_collection_works () {
35- val stream = this .javaClass.classLoader.getResourceAsStream(" propfind.xml" )
35+ val stream = this .javaClass.classLoader!! .getResourceAsStream(" propfind.xml" )
3636 val rootPath = RootPath (" https://foo" )
3737 val res = WebDavService .parsePropfind(stream.reader(), rootPath)
3838 assert (res.size == 8 )
3939 }
4040
4141 @Test
4242 fun propfind_mailbox_org_works () {
43- val stream = this .javaClass.classLoader.getResourceAsStream(" propfind_mailbox_org.xml" )
43+ val stream = this .javaClass.classLoader!! .getResourceAsStream(" propfind_mailbox_org.xml" )
4444 val rootPath = RootPath (" https://foo" )
4545 val res = WebDavService .parsePropfind(stream.reader(), rootPath)
4646 assert (res.size == 4 )
4747 val expected = Resource (
4848 rootPath = rootPath,
4949 href = " /servlet/webdav.infostore/" ,
50- creationdate = ZonedDateTime .parse(" Tue, 11 Jun 2024 20:35:13 GMT" , DateTimeFormatter .RFC_1123_DATE_TIME ).toInstant(),
51- getlastmodified = ZonedDateTime .parse(" Tue, 11 Jun 2024 20:35:13 GMT" , DateTimeFormatter .RFC_1123_DATE_TIME ).toInstant(),
50+ creationdate = ZonedDateTime .parse(
51+ " Tue, 11 Jun 2024 20:35:13 GMT" ,
52+ DateTimeFormatter .RFC_1123_DATE_TIME
53+ ).toInstant(),
54+ getlastmodified = ZonedDateTime .parse(
55+ " Tue, 11 Jun 2024 20:35:13 GMT" ,
56+ DateTimeFormatter .RFC_1123_DATE_TIME
57+ ).toInstant(),
5258 isCollection = true ,
5359 getetag = null ,
5460 getcontentlength = null ,
@@ -59,14 +65,17 @@ class ParseTest {
5965
6066 @Test
6167 fun propfind_file_works () {
62- val stream = this .javaClass.classLoader.getResourceAsStream(" file.xml" )
68+ val stream = this .javaClass.classLoader!! .getResourceAsStream(" file.xml" )
6369 val rootPath = RootPath (" https://foo" )
6470 val res = WebDavService .parsePropfind(stream.reader(), rootPath)
6571 val expected = Resource (
6672 rootPath = rootPath,
6773 href = " /remote.php/dav/files/foouser/DCIM/bar.jpg" ,
6874 creationdate = null ,
69- getlastmodified = ZonedDateTime .parse(" Sat, 10 Jun 2023 21:06:18 GMT" , DateTimeFormatter .RFC_1123_DATE_TIME ).toInstant(),
75+ getlastmodified = ZonedDateTime .parse(
76+ " Sat, 10 Jun 2023 21:06:18 GMT" ,
77+ DateTimeFormatter .RFC_1123_DATE_TIME
78+ ).toInstant(),
7079 isCollection = false ,
7180 getetag = " \" bacfa6f123dee073dc9e20774470681a\" " ,
7281 getcontentlength = " 425623" ,
@@ -77,14 +86,20 @@ class ParseTest {
7786
7887 @Test
7988 fun propfind_apache_file_works () {
80- val stream = this .javaClass.classLoader.getResourceAsStream(" file_apache.xml" )
89+ val stream = this .javaClass.classLoader!! .getResourceAsStream(" file_apache.xml" )
8190 val rootPath = RootPath (" https://foo" )
8291 val res = WebDavService .parsePropfind(stream.reader(), rootPath)
8392 val expected = Resource (
8493 rootPath = rootPath,
8594 href = " /remote.php/dav/files/foouser/DCIM/bar.jpg" ,
86- creationdate = ZonedDateTime .parse(" 2024-01-08T19:14:11Z" , DateTimeFormatter .ISO_DATE_TIME ).toInstant(),
87- getlastmodified = ZonedDateTime .parse(" Mon, 08 Jan 2024 19:14:11 GMT" , DateTimeFormatter .RFC_1123_DATE_TIME ).toInstant(),
95+ creationdate = ZonedDateTime .parse(
96+ " 2024-01-08T19:14:11Z" ,
97+ DateTimeFormatter .ISO_DATE_TIME
98+ ).toInstant(),
99+ getlastmodified = ZonedDateTime .parse(
100+ " Mon, 08 Jan 2024 19:14:11 GMT" ,
101+ DateTimeFormatter .RFC_1123_DATE_TIME
102+ ).toInstant(),
88103 isCollection = false ,
89104 getetag = " \" bacfa6f123dee073dc9e20774470681a\" " ,
90105 getcontentlength = " 425623" ,
@@ -95,14 +110,17 @@ class ParseTest {
95110
96111 @Test
97112 fun propfind_uri_decode_works () {
98- val stream = this .javaClass.classLoader.getResourceAsStream(" file_uri_encoded.xml" )
113+ val stream = this .javaClass.classLoader!! .getResourceAsStream(" file_uri_encoded.xml" )
99114 val rootPath = RootPath (" https://foo" )
100115 val res = WebDavService .parsePropfind(stream.reader(), rootPath)
101116 val expected = Resource (
102117 rootPath = rootPath,
103118 href = " /remote.php/dav/files/foouser/Foo Bar/2023-08-01.jpg" ,
104119 creationdate = null ,
105- getlastmodified = ZonedDateTime .parse(" Sat, 10 Jun 2023 21:06:18 GMT" , DateTimeFormatter .RFC_1123_DATE_TIME ).toInstant(),
120+ getlastmodified = ZonedDateTime .parse(
121+ " Sat, 10 Jun 2023 21:06:18 GMT" ,
122+ DateTimeFormatter .RFC_1123_DATE_TIME
123+ ).toInstant(),
106124 isCollection = false ,
107125 getetag = " \" bacfa6f123dee073dc9e20774470681a\" " ,
108126 getcontentlength = " 425623" ,
@@ -113,14 +131,17 @@ class ParseTest {
113131
114132 @Test
115133 fun propfind_uri_decode2_works () {
116- val stream = this .javaClass.classLoader.getResourceAsStream(" file_uri_encoded2.xml" )
134+ val stream = this .javaClass.classLoader!! .getResourceAsStream(" file_uri_encoded2.xml" )
117135 val rootPath = RootPath (" https://foo" )
118136 val res = WebDavService .parsePropfind(stream.reader(), rootPath)
119137 val expected = Resource (
120138 rootPath = rootPath,
121139 href = " /remote.php/dav/files/foouser/#1234 (1).pdf" ,
122140 creationdate = null ,
123- getlastmodified = ZonedDateTime .parse(" Sat, 10 Jun 2023 21:06:18 GMT" , DateTimeFormatter .RFC_1123_DATE_TIME ).toInstant(),
141+ getlastmodified = ZonedDateTime .parse(
142+ " Sat, 10 Jun 2023 21:06:18 GMT" ,
143+ DateTimeFormatter .RFC_1123_DATE_TIME
144+ ).toInstant(),
124145 isCollection = false ,
125146 getetag = " \" bacfa6f123dee073dc9e20774470681a\" " ,
126147 getcontentlength = " 425623" ,
@@ -131,14 +152,17 @@ class ParseTest {
131152
132153 @Test
133154 fun propfind_directory_works () {
134- val stream = this .javaClass.classLoader.getResourceAsStream(" directory.xml" )
155+ val stream = this .javaClass.classLoader!! .getResourceAsStream(" directory.xml" )
135156 val rootPath = RootPath (" https://foo" )
136157 val res = WebDavService .parsePropfind(stream.reader(), rootPath)
137158 val expected = Resource (
138159 rootPath = rootPath,
139160 href = " /remote.php/dav/files/foouser/Documents/" ,
140161 creationdate = null ,
141- getlastmodified = ZonedDateTime .parse(" Thu, 01 Jun 2023 08:16:46 GMT" , DateTimeFormatter .RFC_1123_DATE_TIME ).toInstant(),
162+ getlastmodified = ZonedDateTime .parse(
163+ " Thu, 01 Jun 2023 08:16:46 GMT" ,
164+ DateTimeFormatter .RFC_1123_DATE_TIME
165+ ).toInstant(),
142166 isCollection = true ,
143167 getetag = " \" 647853ef0e5ec\" " ,
144168 )
0 commit comments