|
6 | 6 | import io.frictionlessdata.datapackage.exceptions.DataPackageException; |
7 | 7 | import io.frictionlessdata.datapackage.exceptions.DataPackageFileOrUrlNotFoundException; |
8 | 8 | import io.frictionlessdata.datapackage.exceptions.DataPackageValidationException; |
9 | | -import io.frictionlessdata.datapackage.resource.FilebasedResource; |
10 | | -import io.frictionlessdata.datapackage.resource.JSONDataResource; |
11 | | -import io.frictionlessdata.datapackage.resource.Resource; |
12 | | -import io.frictionlessdata.datapackage.resource.ResourceTest; |
| 9 | +import io.frictionlessdata.datapackage.resource.*; |
13 | 10 | import io.frictionlessdata.tableschema.exception.ValidationException; |
14 | 11 | import io.frictionlessdata.tableschema.field.DateField; |
15 | 12 | import io.frictionlessdata.tableschema.schema.Schema; |
@@ -379,32 +376,33 @@ public void testNonTabularPackage() throws Exception{ |
379 | 376 |
|
380 | 377 | Resource<?,?> resource = dp.getResource("logo-svg"); |
381 | 378 | Assertions.assertTrue(resource instanceof FilebasedResource); |
382 | | - Object rawData = resource.getRawData(); |
| 379 | + byte[] rawData = (byte[])resource.getRawData(); |
| 380 | + String s = new String (rawData).replaceAll("[\n\r]+", "\n"); |
383 | 381 |
|
384 | 382 | byte[] testData = TestUtil.getResourceContent("/fixtures/files/frictionless-color-full-logo.svg"); |
385 | | - Assertions.assertArrayEquals(testData, (byte[])rawData); |
| 383 | + String t = new String (testData).replaceAll("[\n\r]+", "\n"); |
| 384 | + Assertions.assertEquals(t, s); |
386 | 385 | } |
387 | 386 |
|
388 | | -/* |
| 387 | + |
389 | 388 | @Test |
390 | 389 | @DisplayName("Test getting resource data from a non-tabular datapackage, URL based") |
391 | 390 | public void testNonTabularPackageUrl() throws Exception{ |
392 | | - URL input = new URL("https://raw.githubusercontent.com/frictionlessdata/datapackage-java" + |
393 | | - "/master/src/test/resources//fixtures/datapackages/non-tabular/datapackage.json"); |
| 391 | + URL input = new URL("https://raw.githubusercontent.com/frictionlessdata/datapackage-java/master" + |
| 392 | + "/src/test/resources/fixtures/datapackages/non-tabular/datapackage.json"); |
394 | 393 |
|
395 | 394 | Package dp = new Package(input, true); |
396 | 395 |
|
397 | 396 | Resource<?,?> resource = dp.getResource("logo-svg"); |
398 | | - Assertions.assertTrue(resource instanceof FilebasedResource); |
399 | | - Object rawData = resource.getRawData(); |
| 397 | + Assertions.assertTrue(resource instanceof URLbasedResource); |
| 398 | + byte[] rawData = (byte[])resource.getRawData(); |
| 399 | + String s = new String (rawData).replaceAll("[\n\r]+", "\n"); |
400 | 400 |
|
401 | 401 | byte[] testData = TestUtil.getResourceContent("/fixtures/files/frictionless-color-full-logo.svg"); |
402 | | - Assertions.assertArrayEquals(testData, (byte[])rawData); |
| 402 | + String t = new String (testData).replaceAll("[\n\r]+", "\n"); |
| 403 | + Assertions.assertEquals(t, s); |
403 | 404 | } |
404 | 405 |
|
405 | | - */ |
406 | | - |
407 | | - |
408 | 406 | @Test |
409 | 407 | @DisplayName("Test setting the 'profile' property") |
410 | 408 | public void testSetProfile() throws Exception { |
|
0 commit comments