FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
node-java/test/java-callStaticMethod-test.js at master · ddopson/node-java · GitHub
ddopson
/
node-java
Public
forked from
joeferner/node-java
Notifications
You must be signed in to change notification settings
Fork
1
Star
2
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
node-java
/
test
/
java-callStaticMethod-test.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
119 lines (102 loc) · 3.21 KB
Breadcrumbs
node-java
/
test
/
java-callStaticMethod-test.js
Copy path
File metadata and controls
119 lines (102 loc) · 3.21 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
var
java
=
require
(
"../testHelpers"
)
.
java
;
var
nodeunit
=
require
(
"nodeunit"
)
;
var
util
=
require
(
"util"
)
;
exports
[
'Java - Call Static Method'
]
=
nodeunit
.
testCase
(
{
"callStaticMethod"
:
function
(
test
)
{
java
.
callStaticMethod
(
"Test"
,
"staticMethod"
,
function
(
err
,
result
)
{
test
.
ok
(
result
)
;
test
.
equal
(
result
,
"staticMethod called"
)
;
test
.
done
(
)
;
}
)
;
}
,
"callStaticMethodSync"
:
function
(
test
)
{
var
result
=
java
.
callStaticMethodSync
(
"Test"
,
"staticMethod"
)
;
test
.
ok
(
result
)
;
test
.
equal
(
result
,
"staticMethod called"
)
;
test
.
done
(
)
;
}
,
"callStaticMethod with args"
:
function
(
test
)
{
java
.
callStaticMethod
(
"Test"
,
"staticMethod"
,
42
,
function
(
err
,
result
)
{
test
.
ok
(
result
)
;
test
.
equal
(
result
,
43
)
;
test
.
done
(
)
;
}
)
;
}
,
"callStaticMethodSync with args"
:
function
(
test
)
{
var
result
=
java
.
callStaticMethodSync
(
"Test"
,
"staticMethod"
,
42
)
;
test
.
ok
(
result
)
;
test
.
equal
(
result
,
43
)
;
test
.
done
(
)
;
}
,
"callStaticMethod bad class name"
:
function
(
test
)
{
java
.
callStaticMethod
(
"BadClassName"
,
"staticMethod"
,
function
(
err
,
result
)
{
test
.
ok
(
err
)
;
test
.
ok
(
!
result
)
;
test
.
done
(
)
;
}
)
;
}
,
"callStaticMethodSync bad class name"
:
function
(
test
)
{
test
.
throws
(
function
(
)
{
java
.
callStaticMethodSync
(
"BadClassName"
,
"staticMethod"
)
;
}
)
;
test
.
done
(
)
;
}
,
"callStaticMethod bad arg types"
:
function
(
test
)
{
java
.
callStaticMethod
(
"Test"
,
"staticMethod"
,
"z"
,
function
(
err
,
result
)
{
test
.
ok
(
err
)
;
test
.
ok
(
!
result
)
;
test
.
done
(
)
;
}
)
;
}
,
"callStaticMethodSync bad arg types"
:
function
(
test
)
{
test
.
throws
(
function
(
)
{
java
.
callStaticMethodSync
(
"Test"
,
"staticMethod"
,
"z"
)
;
}
)
;
test
.
done
(
)
;
}
,
"callStaticMethod bad number of args"
:
function
(
test
)
{
java
.
callStaticMethod
(
"Test"
,
"staticMethod"
,
42
,
"z"
,
function
(
err
,
result
)
{
test
.
ok
(
err
)
;
test
.
ok
(
!
result
)
;
test
.
done
(
)
;
}
)
;
}
,
"callStaticMethodSync bad number of args"
:
function
(
test
)
{
test
.
throws
(
function
(
)
{
java
.
callStaticMethodSync
(
"Test"
,
"staticMethod"
,
42
,
"z"
)
;
}
)
;
test
.
done
(
)
;
}
,
"callStaticMethod bad method name"
:
function
(
test
)
{
java
.
callStaticMethod
(
"Test"
,
"badMethodName"
,
function
(
err
,
result
)
{
test
.
ok
(
err
)
;
test
.
ok
(
!
result
)
;
test
.
done
(
)
;
}
)
;
}
,
"callStaticMethodSync bad method name"
:
function
(
test
)
{
test
.
throws
(
function
(
)
{
java
.
callStaticMethodSync
(
"Test"
,
"badMethodName"
)
;
}
)
;
test
.
done
(
)
;
}
,
"callStaticMethod exception thrown from method"
:
function
(
test
)
{
var
ex
=
java
.
newInstanceSync
(
"java.lang.Exception"
,
"my exception"
)
;
java
.
callStaticMethod
(
"Test"
,
"staticMethodThrows"
,
ex
,
function
(
err
,
result
)
{
test
.
ok
(
err
)
;
test
.
ok
(
err
.
toString
(
)
.
match
(
/
m
y
e
x
c
e
p
t
i
o
n
/
)
)
;
test
.
ok
(
!
result
)
;
test
.
done
(
)
;
}
)
;
}
,
"callStaticMethodSync exception thrown from method"
:
function
(
test
)
{
var
ex
=
java
.
newInstanceSync
(
"java.lang.Exception"
,
"my exception"
)
;
try
{
java
.
callStaticMethodSync
(
"Test"
,
"staticMethodThrows"
,
ex
)
;
test
.
fail
(
"should throw"
)
;
}
catch
(
err
)
{
test
.
ok
(
err
.
toString
(
)
.
match
(
/
m
y
e
x
c
e
p
t
i
o
n
/
)
)
;
}
test
.
done
(
)
;
}
,
}
)
;
Back
|
FazBrowse Home
|
New Git URL