Skip to content

Commit

Permalink
Add dependency to the main test-jar (#8)
Browse files Browse the repository at this point in the history
* Add dependency to the main test-jar

* Make sample test rely on RefineTest
  • Loading branch information
wetneb authored May 26, 2024
1 parent 2f40c27 commit 5503a5f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
16 changes: 13 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
<description>Example extension provided for demonstration purposes</description>
<url>http://openrefine.org/</url>

<properties>
<openrefine.version>3.8.1</openrefine.version>
</properties>

<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -73,7 +77,7 @@
<dependency>
<groupId>org.openrefine</groupId>
<artifactId>main</artifactId>
<version>3.8.1</version>
<version>${openrefine.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -83,15 +87,21 @@
<scope>provided</scope>
</dependency>

<!-- add here the dependencies of your extension -->
<!-- add here the dependencies of your extension -->

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.10.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openrefine</groupId>
<artifactId>main</artifactId>
<version>${openrefine.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>

</project>

Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,23 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertThrows;

import java.io.Serializable;

import org.testng.annotations.Test;
import com.google.refine.RefineTest;
import com.google.refine.model.Project;

public class SampleUtilTest {
public class SampleUtilTest extends RefineTest {

@Test
public void testStringArrayLength() {
// you can use the same sort of test utilities as in OpenRefine's own test suite
Project project = createProject(new String[] { "first column", "second column" },
new Serializable[][] {
{ "a", "b" },
{ "c", 3 }
});

String[] myArray = new String[] { "foo", "bar" };

assertEquals(SampleUtil.stringArrayLength(myArray), 2);
Expand Down

0 comments on commit 5503a5f

Please sign in to comment.