FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java/src/test/java/com/jsoniter/TestReadAny.java at master · ws-php/java · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
ws-php
/
java
Public
forked from
json-iterator/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
java
/
src
/
test
/
java
/
com
/
jsoniter
/
TestReadAny.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
21 lines (18 loc) · 791 Bytes
Breadcrumbs
java
/
src
/
test
/
java
/
com
/
jsoniter
/
TestReadAny.java
Copy path
File metadata and controls
21 lines (18 loc) · 791 Bytes
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
package
com
.
jsoniter
;
import
junit
.
framework
.
TestCase
;
import
java
.
io
.
IOException
;
public
class
TestReadAny
extends
TestCase
{
public
void
test_read_any
()
throws
IOException
{
JsonIterator
iter
=
JsonIterator
.
parse
(
"[0,1,2,3]"
);
assertEquals
(
3
,
iter
.
readAny
().
toInt
(
3
));
}
public
void
test_bind_to_any
()
throws
IOException
{
JsonIterator
iter
=
JsonIterator
.
parse
(
"{'field3': 100}"
.
replace
(
'\''
,
'"'
));
ComplexObject
obj
=
iter
.
read
(
ComplexObject
.
class
);
System
.
out
.
println
(
obj
.
field3
);
}
public
void
test_read_any_from_string
()
throws
IOException
{
JsonIterator
iter
=
JsonIterator
.
parse
(
"{'numbers': ['1', '2', ['3', '4']]}"
.
replace
(
'\''
,
'"'
));
assertEquals
(
3
,
iter
.
readAny
().
toInt
(
"numbers"
,
2
,
0
));
}
}
Back
|
FazBrowse Home
|
New Git URL