Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filters feature #55

Merged
merged 41 commits into from
Jul 17, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
c2889c0
Added a new argument placeholder, renamed filter to package-filter
alexzaitsev Jul 9, 2019
c22013e
Prepared for filters file parsing
alexzaitsev Jul 9, 2019
452c46c
Moved all filters to json config. Changed argument reading. FiltersRe…
alexzaitsev Jul 9, 2019
1dd6f0a
Added filters logic, started working on SmaliAnalyzer
alexzaitsev Jul 10, 2019
3c96378
Futher work on filters feature
alexzaitsev Jul 10, 2019
5d242bf
code fixes
alexzaitsev Jul 10, 2019
2efc369
moved source classes to com.alex_zaitsev.adg package, added JUnit4 su…
alexzaitsev Jul 12, 2019
fca3a5e
added tests for ArgumentReader
alexzaitsev Jul 12, 2019
5c02392
removed run task from Ant. Added tests for FiltersReader, improved te…
alexzaitsev Jul 12, 2019
442b386
Fix Gradle build (#53)
SupinePandora43 Jul 15, 2019
234cdf5
enhansed tests
alexzaitsev Jul 15, 2019
eb39b5d
Test logger is added to Gradle (#54)
SupinePandora43 Jul 15, 2019
14fe9a1
started working on SmaliAnalyzer tests
alexzaitsev Jul 15, 2019
26b3116
progress with SmaliAnalyzer tests
alexzaitsev Jul 15, 2019
382c999
moved Filter creation to separate class. Created class for testing Fi…
alexzaitsev Jul 15, 2019
6a1f651
added tests for FilterProvider.makePathFilter
alexzaitsev Jul 16, 2019
b40b503
code improvements. run scripts were adjusted to the feature changes
alexzaitsev Jul 16, 2019
570dc86
added and modified FilterProvider tests
alexzaitsev Jul 16, 2019
5a30cc0
reverted path creation in the tests
alexzaitsev Jul 16, 2019
2ee6912
improved tests
alexzaitsev Jul 16, 2019
7e5cbe2
tests
alexzaitsev Jul 16, 2019
889a51a
tests, fixed SmaliAnalyzer
alexzaitsev Jul 16, 2019
8b5aff5
modified default filterset
alexzaitsev Jul 16, 2019
ce517e0
fix tests for windows
alexzaitsev Jul 16, 2019
323da09
fix tests for windows
alexzaitsev Jul 16, 2019
216b4cf
fix tests for windows
alexzaitsev Jul 16, 2019
91977cc
fix windows tests
alexzaitsev Jul 16, 2019
10fcced
Update instructions.txt
alexzaitsev Jul 16, 2019
7ce5961
Update README.md
alexzaitsev Jul 16, 2019
611d7b7
Update README.md
alexzaitsev Jul 16, 2019
9bb8d4e
Update README.md
alexzaitsev Jul 16, 2019
e81a96a
Update README.md
alexzaitsev Jul 16, 2019
7bf218e
Update README.md
alexzaitsev Jul 16, 2019
d967e0c
Update README.md
alexzaitsev Jul 16, 2019
9336da2
updated release build
alexzaitsev Jul 16, 2019
53a2100
fix release script
alexzaitsev Jul 16, 2019
72106f5
simplified tests
alexzaitsev Jul 16, 2019
d4d4253
improved filters
alexzaitsev Jul 16, 2019
41027d0
fix tests
alexzaitsev Jul 16, 2019
4bef69d
updated version badge
alexzaitsev Jul 17, 2019
339e0a0
updated version badge
alexzaitsev Jul 17, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
enhansed tests
  • Loading branch information
alexzaitsev committed Jul 15, 2019
commit 234cdf5412c47c34221a83af22e73a0b900de422
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ apk-dependency-graph-scripts-*.zip
lib
filters/*.json
!filters/default.json

.vscode
4 changes: 2 additions & 2 deletions src/test/java/ArgumentReaderTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void nonExistingApkPathReturnsNullAndPrintsMessage() {
Arguments args = sut.read();

assertThat(args, nullValue());
String message = "/wrong is not found!";
String message = File.separator + "wrong is not found!";
assertThat(errContent.toString(), containsString(message));
}

Expand All @@ -86,7 +86,7 @@ public void wrongFilterFileReturnsNullAndPrintsMessage() {
Arguments args = sut.read();

assertThat(args, nullValue());
String message = "/wrong is not found!";
String message = File.separator + "wrong is not found!";
assertThat(errContent.toString(), containsString(message));
}

Expand Down
24 changes: 23 additions & 1 deletion src/test/java/FiltersReaderTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class FiltersReaderTests {

private static final String PACKAGE_NAME = "com.example.package";
private static final boolean SHOW_INNER_CLASSES_DEFAULT = false;
private static final boolean SHOW_INNER_CLASSES_TRUE = true;
private static final String[] IGNORED_CLASSES_DEFAULT = new String[] {
".*Dagger.*", ".*Injector.*", ".*\\$_ViewBinding$", ".*_Factory$"
};
Expand All @@ -30,6 +31,11 @@ public class FiltersReaderTests {
"\"show-inner-classes\": false," +
"\"ignored-classes\": [\".*Dagger.*\", \".*Injector.*\", \".*\\$_ViewBinding$\", \".*_Factory$\"]" +
"}";
private static final String FILTERS_SHOW_INNER_TRUE = "{" +
"\"package-name\": \"com.example.package\"," +
"\"show-inner-classes\": true," +
"\"ignored-classes\": [\".*Dagger.*\", \".*Injector.*\", \".*\\$_ViewBinding$\", \".*_Factory$\"]" +
"}";
private static final String FILTERS_FULL = "{" +
"\"package-name\": \"com.example.package\"," +
"\"show-inner-classes\": false," +
Expand Down Expand Up @@ -158,8 +164,24 @@ public void correctFiltersFileReturnsFilters() throws IOException {
assertThat(filters.getIgnoredClasses(), equalTo(IGNORED_CLASSES_DEFAULT));
}

/**
* When `show-inner-classes` option is enabled,
* read() must return correct Filters and info message is printed.
*/
@Test
public void correctFiltersFileWithEnabledInnerClassesPrintsMessage() throws IOException {
// TODO
FileWriter fw = new FileWriter(filterFile);
fw.write(FILTERS_SHOW_INNER_TRUE);
fw.close();
FiltersReader sut = new FiltersReader(filterFile.getAbsolutePath());

Filters filters = sut.read();

assertThat(filters, notNullValue());
assertThat(filters.getPackageName(), equalTo(PACKAGE_NAME));
assertThat(filters.isProcessingInner(), equalTo(SHOW_INNER_CLASSES_TRUE));
assertThat(filters.getIgnoredClasses(), equalTo(IGNORED_CLASSES_DEFAULT));
String message = "Warning! Processing including inner classes.";
assertThat(outContent.toString(), containsString(message));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
import org.junit.Ignore;

@Ignore
public class WriterTests {
public class SmaliAnalyzerTests {

}