-
Notifications
You must be signed in to change notification settings - Fork 866
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix npe for bigint/double/long function
fix null pointer execepiton for bigint double and long function
- Loading branch information
Showing
6 changed files
with
84 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/test/java/com/googlecode/aviator/runtime/function/system/BigIntFunctionUnitTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.googlecode.aviator.runtime.function.system; | ||
|
||
import com.googlecode.aviator.runtime.type.AviatorJavaType; | ||
import org.junit.Test; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
|
||
public class BigIntFunctionUnitTest { | ||
@Test(expected = ClassCastException.class) | ||
public void testCall_WithJavaTypeNullArgument() { | ||
BigIntFunction bigIntFunction = new BigIntFunction(); | ||
AviatorJavaType aviatorJavaType = new AviatorJavaType("var"); | ||
bigIntFunction.call(null, aviatorJavaType); | ||
} | ||
|
||
@Test(expected = ClassCastException.class) | ||
public void testCall_WithJavaTypeNotSupportArgument() { | ||
BigIntFunction bigIntFunction = new BigIntFunction(); | ||
AviatorJavaType aviatorJavaType = new AviatorJavaType("var"); | ||
Map<String, Object> env = new HashMap<>(); | ||
env.put("var", true); | ||
|
||
bigIntFunction.call(env, aviatorJavaType); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/test/java/com/googlecode/aviator/runtime/function/system/DoubleFunctionUnitTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.googlecode.aviator.runtime.function.system; | ||
|
||
import com.googlecode.aviator.runtime.type.AviatorJavaType; | ||
import org.junit.Test; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
|
||
public class DoubleFunctionUnitTest { | ||
@Test(expected = ClassCastException.class) | ||
public void testCall_WithJavaTypeNullArgument() { | ||
DoubleFunction doubleFunction = new DoubleFunction(); | ||
AviatorJavaType aviatorJavaType = new AviatorJavaType("var"); | ||
doubleFunction.call(null, aviatorJavaType); | ||
} | ||
|
||
@Test(expected = ClassCastException.class) | ||
public void testCall_WithJavaTypeNotSupportArgument() { | ||
DoubleFunction doubleFunction = new DoubleFunction(); | ||
AviatorJavaType aviatorJavaType = new AviatorJavaType("var"); | ||
Map<String, Object> env = new HashMap<>(); | ||
env.put("var", true); | ||
|
||
doubleFunction.call(env, aviatorJavaType); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/test/java/com/googlecode/aviator/runtime/function/system/LongFunctionUnitTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.googlecode.aviator.runtime.function.system; | ||
|
||
import com.googlecode.aviator.runtime.type.AviatorJavaType; | ||
import org.junit.Test; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
|
||
public class LongFunctionUnitTest { | ||
@Test(expected = ClassCastException.class) | ||
public void testCall_WithJavaTypeNullArgument() { | ||
LongFunction longFunction = new LongFunction(); | ||
AviatorJavaType aviatorJavaType = new AviatorJavaType("var"); | ||
longFunction.call(null, aviatorJavaType); | ||
} | ||
|
||
@Test(expected = ClassCastException.class) | ||
public void testCall_WithJavaTypeNotSupportArgument() { | ||
LongFunction longFunction = new LongFunction(); | ||
AviatorJavaType aviatorJavaType = new AviatorJavaType("var"); | ||
Map<String, Object> env = new HashMap<>(); | ||
env.put("var", true); | ||
|
||
longFunction.call(env, aviatorJavaType); | ||
} | ||
} |