Permalink
Browse files

Basic test to exercise JNA binding

  • Loading branch information...
1 parent 09f5704 commit 495065ab1ff0c3a20576460ef85b1c8142aecef3 @samstokes samstokes committed May 23, 2012
Showing with 51 additions and 0 deletions.
  1. +9 −0 pom.xml
  2. +42 −0 src/test/java/com/rapportive/jawbone/JawboneTest.java
View
@@ -29,6 +29,15 @@
<build>
<plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.12</version>
+ <configuration>
+ <argLine>-Djna.library.path=${basedir}/lib</argLine>
+ </configuration>
+ </plugin>
+
<!-- Compile to Java 1.6 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -0,0 +1,42 @@
+package com.rapportive.jawbone;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.OutputStream;
+
+import static org.junit.Assert.*;
+
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.sun.jna.Pointer;
+
+import com.sun.jna.ptr.LongByReference;
+import com.sun.jna.ptr.PointerByReference;
+
+public class JawboneTest {
+
+ private static JawboneBinding binding;
+ private PointerByReference jawbonePtr = new PointerByReference();
+ private Pointer jawbone;
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ binding = JawboneBinding.INSTANCE;
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ int ret = binding.wbxml_conv_wbxml2xml_create(jawbonePtr);
+ assertEquals("wbxml_conv_wbxml2xml_create failed", 0, ret);
+ jawbone = jawbonePtr.getValue();
+ // TODO worry about cleanup
+ }
+
+ @Test
+ public void test() throws Exception {
+ assertNotNull(jawbone);
+ }
+}

0 comments on commit 495065a

Please sign in to comment.