@@ -6,7 +6,6 @@ import org.json.JSONObject
66import org.junit.jupiter.api.Assertions.assertEquals
77import org.junit.jupiter.api.Test
88import org.junit.jupiter.api.assertThrows
9- import kotlin.jvm.java
109
1110class LPFCPTests {
1211 /*
@@ -188,6 +187,7 @@ class LPFCPTests {
188187
189188 interface Calculator {
190189 fun hello (): String
190+ fun hello (name : String? ): String
191191 fun add (a : Int , b : Int ): Int
192192 fun add (a : String = "1", b : String = "2"): String
193193 fun multiply (a : Int , b : Int ): Int
@@ -200,6 +200,9 @@ class LPFCPTests {
200200 @LPFCP.ExposedFunction
201201 override fun hello (): String = " Hello, World!"
202202
203+ @LPFCP.ExposedFunction
204+ override fun hello (name : String? ): String = " Hello, $name !"
205+
203206 @LPFCP.ExposedFunction
204207 override fun add (a : Int , b : Int ): Int = a + b
205208
@@ -216,14 +219,22 @@ class LPFCPTests {
216219 }
217220 }
218221
219- @Test fun getProcessor_withLambda_proceedsRequest_withValidFunctionWithNoArgsAndNoArgs_returnsSuccess () {
222+ @Test fun getProcessor_withLambda_proceedsRequest_withValidFunctionWithNoArgs_returnsSuccess () {
220223 val processor = LPFCP .getProcessor<Calculator > { request, _ ->
221224 LPFCP .processRequest(request, calculator).getOrThrow()
222225 }
223226 val result = processor.hello()
224227 assertEquals(" Hello, World!" , result)
225228 }
226229
230+ @Test fun getProcessor_withLambda_proceedsRequest_withValidFunctionWithNullArgs_returnsSuccess () {
231+ val processor = LPFCP .getProcessor<Calculator > { request, _ ->
232+ LPFCP .processRequest(request, calculator).getOrThrow()
233+ }
234+ val result = processor.hello(null )
235+ assertEquals(" Hello, null!" , result)
236+ }
237+
227238 @Test fun getProcessor_withLambda_proceedsRequest_withValidFunctionAndArgs_returnsSuccess () {
228239 val processor = LPFCP .getProcessor<Calculator > { request, _ ->
229240 LPFCP .processRequest(request, calculator).getOrThrow()
0 commit comments