Skip to content

Commit 1094c66

Browse files
Added test, bump tableschema-version
1 parent b1ed2d3 commit 1094c66

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<java.version>8</java.version>
2323
<maven.compiler.source>${java.version}</maven.compiler.source>
2424
<maven.compiler.target>${java.version}</maven.compiler.target>
25-
<tableschema-java-version>0.6.9</tableschema-java-version>
25+
<tableschema-java-version>0.6.10</tableschema-java-version>
2626
<hamcrest.version>1.3</hamcrest.version>
2727
<junit.version>5.9.1</junit.version>
2828
<slf4j-simple.version>2.0.5</slf4j-simple.version>

src/test/java/io/frictionlessdata/datapackage/PackageTest.java

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
import io.frictionlessdata.datapackage.exceptions.DataPackageException;
77
import io.frictionlessdata.datapackage.exceptions.DataPackageFileOrUrlNotFoundException;
88
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.*;
1310
import io.frictionlessdata.tableschema.exception.ValidationException;
1411
import io.frictionlessdata.tableschema.field.DateField;
1512
import io.frictionlessdata.tableschema.schema.Schema;
@@ -379,32 +376,33 @@ public void testNonTabularPackage() throws Exception{
379376

380377
Resource<?,?> resource = dp.getResource("logo-svg");
381378
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");
383381

384382
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);
386385
}
387386

388-
/*
387+
389388
@Test
390389
@DisplayName("Test getting resource data from a non-tabular datapackage, URL based")
391390
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");
394393

395394
Package dp = new Package(input, true);
396395

397396
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");
400400

401401
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);
403404
}
404405

405-
*/
406-
407-
408406
@Test
409407
@DisplayName("Test setting the 'profile' property")
410408
public void testSetProfile() throws Exception {

0 commit comments

Comments
 (0)