Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
jadx
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
jadx
Commits
0a241e3a
Commit
0a241e3a
authored
Jun 28, 2014
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core tests: add custom string matchers
parent
37857e88
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
0 deletions
+47
-0
CountString.java
jadx-core/src/test/java/jadx/tests/utils/CountString.java
+33
-0
JadxMatchers.java
jadx-core/src/test/java/jadx/tests/utils/JadxMatchers.java
+14
-0
No files found.
jadx-core/src/test/java/jadx/tests/utils/CountString.java
0 → 100644
View file @
0a241e3a
package
jadx
.
tests
.
utils
;
import
org.hamcrest.core.SubstringMatcher
;
public
class
CountString
extends
SubstringMatcher
{
private
final
int
count
;
public
CountString
(
int
count
,
String
substring
)
{
super
(
substring
);
this
.
count
=
count
;
}
@Override
protected
boolean
evalSubstringOf
(
String
string
)
{
return
this
.
count
==
countStr
(
string
,
substring
);
}
@Override
protected
String
relationship
()
{
return
"containing "
+
count
+
" occurrence of"
;
}
private
static
int
countStr
(
String
string
,
String
substring
)
{
int
cnt
=
0
;
int
idx
=
0
;
while
((
idx
=
string
.
indexOf
(
substring
,
idx
))
!=
-
1
)
{
idx
++;
cnt
++;
}
return
cnt
;
}
}
jadx-core/src/test/java/jadx/tests/utils/JadxMatchers.java
0 → 100644
View file @
0a241e3a
package
jadx
.
tests
.
utils
;
import
org.hamcrest.Matcher
;
public
class
JadxMatchers
{
public
static
Matcher
<
String
>
countString
(
int
count
,
String
substring
)
{
return
new
CountString
(
count
,
substring
);
}
public
static
Matcher
<
String
>
containsOne
(
String
substring
)
{
return
new
CountString
(
1
,
substring
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment