FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
node-java/test/java-newInstance-test.js at master · ws-apps/node-java · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
ws-apps
/
node-java
Public
forked from
joeferner/node-java
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
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-newInstance-test.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
121 lines (103 loc) · 3.13 KB
Breadcrumbs
node-java
/
test
/
java-newInstance-test.js
Copy path
File metadata and controls
121 lines (103 loc) · 3.13 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
120
121
var
java
=
require
(
"../testHelpers"
)
.
java
;
var
nodeunit
=
require
(
"nodeunit"
)
;
var
util
=
require
(
"util"
)
;
exports
[
'Java - New Instance'
]
=
nodeunit
.
testCase
(
{
"newInstance"
:
function
(
test
)
{
java
.
newInstance
(
"Test"
,
function
(
err
,
result
)
{
test
.
ok
(
result
)
;
test
.
equal
(
result
.
getClassSync
(
)
.
toStringSync
(
)
,
"class Test"
)
;
test
.
ok
(
result
.
getInt
)
;
test
.
ok
(
result
.
getIntSync
)
;
test
.
ok
(
!
result
.
staticMethod
)
;
test
.
ok
(
!
result
.
staticMethodSync
)
;
test
.
equal
(
result
.
nonstaticInt
,
42
)
;
test
.
done
(
)
;
}
)
;
}
,
"newInstanceSync"
:
function
(
test
)
{
var
result
=
java
.
newInstanceSync
(
"Test"
)
;
test
.
ok
(
result
)
;
test
.
equal
(
result
.
getClassSync
(
)
.
toStringSync
(
)
,
"class Test"
)
;
test
.
done
(
)
;
}
,
"newInstance with args"
:
function
(
test
)
{
java
.
newInstance
(
"Test"
,
42
,
function
(
err
,
result
)
{
test
.
ok
(
result
)
;
test
.
equal
(
result
.
getIntSync
(
)
,
42
)
;
test
.
done
(
)
;
}
)
;
}
,
"newInstanceSync with args"
:
function
(
test
)
{
var
result
=
java
.
newInstanceSync
(
"Test"
,
42
)
;
test
.
ok
(
result
)
;
test
.
equal
(
result
.
getIntSync
(
)
,
42
)
;
test
.
done
(
)
;
}
,
"newInstance bad class name"
:
function
(
test
)
{
java
.
newInstance
(
"BadClassName"
,
function
(
err
,
result
)
{
test
.
ok
(
err
)
;
test
.
ok
(
!
result
)
;
test
.
done
(
)
;
}
)
;
}
,
"newInstanceSync bad class name"
:
function
(
test
)
{
test
.
throws
(
function
(
)
{
java
.
newInstanceSync
(
"BadClassName"
)
;
}
)
;
test
.
done
(
)
;
}
,
"newInstance bad arg types"
:
function
(
test
)
{
java
.
newInstance
(
"Test"
,
'a'
,
function
(
err
,
result
)
{
test
.
ok
(
err
)
;
test
.
ok
(
!
result
)
;
test
.
done
(
)
;
}
)
;
}
,
"newInstanceSync bad arg types"
:
function
(
test
)
{
test
.
throws
(
function
(
)
{
java
.
newInstanceSync
(
"Test"
,
'a'
)
;
}
)
;
test
.
done
(
)
;
}
,
"newInstance bad number of args"
:
function
(
test
)
{
java
.
newInstance
(
"Test"
,
42
,
15
,
function
(
err
,
result
)
{
test
.
ok
(
err
)
;
test
.
ok
(
!
result
)
;
test
.
done
(
)
;
}
)
;
}
,
"newInstanceSync bad number of args"
:
function
(
test
)
{
test
.
throws
(
function
(
)
{
java
.
newInstanceSync
(
"Test"
,
42
,
15
)
;
}
)
;
test
.
done
(
)
;
}
,
"newInstance exception thrown from constructor"
:
function
(
test
)
{
var
ex
=
java
.
newInstanceSync
(
"java.lang.Exception"
,
"my exception"
)
;
java
.
newInstance
(
"TestExceptions"
,
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
(
)
;
}
)
;
}
,
"newInstanceSync exception thrown from constructor"
:
function
(
test
)
{
var
ex
=
java
.
newInstanceSync
(
"java.lang.Exception"
,
"my exception"
)
;
try
{
java
.
newInstanceSync
(
"TestExceptions"
,
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
(
)
;
}
,
"newInstanceSync with varargs"
:
function
(
test
)
{
var
result
=
java
.
newInstanceSync
(
"Test"
,
42
,
java
.
newArray
(
'java.lang.String'
,
[
"a"
,
"b"
]
)
)
;
test
.
ok
(
result
)
;
result
=
java
.
newInstanceSync
(
"Test"
,
42
,
"a"
)
;
test
.
ok
(
result
)
;
result
=
java
.
newInstanceSync
(
"Test"
,
42
,
"a"
,
"b"
,
"c"
)
;
test
.
ok
(
result
)
;
test
.
done
(
)
;
}
}
)
;
Back
|
FazBrowse Home
|
New Git URL