diff --git a/test/de/inetsoftware/jwebassembly/SampleCompileTest.java b/test/de/inetsoftware/jwebassembly/SampleCompileTest.java index 6760f35..8f09705 100644 --- a/test/de/inetsoftware/jwebassembly/SampleCompileTest.java +++ b/test/de/inetsoftware/jwebassembly/SampleCompileTest.java @@ -18,6 +18,7 @@ package de.inetsoftware.jwebassembly; import static org.junit.Assert.*; import java.io.File; +import java.io.OutputStream; import java.net.URL; import java.nio.file.Files; import java.util.ArrayList; @@ -88,6 +89,20 @@ public class SampleCompileTest { assertArrayEquals( expected, actual ); } + @Test + public void npe() throws Exception { + JWebAssembly webAsm = new JWebAssembly(); + webAsm.addFile( classFile ); + try { + webAsm.compileToBinary( (OutputStream)null ); + fail(); + } catch( WasmException ex ) { + // expected + assertTrue( "" + ex.getCause(), ex.getCause() instanceof NullPointerException ); + } + } + + // @Test // public void compileToBinary() throws Exception { // URL url = SampleCompileTest.class.getResource( "samples/" + testName + ".wasm" );