-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(jans-orm): fixed npe in filter processor and covered with tests
docs: no docs required
- Loading branch information
Showing
8 changed files
with
119 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
jans-orm/filter/src/test/java/io/jans/orm/search/filter/FileProcessorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package io.jans.orm.search.filter; | ||
|
||
import io.jans.orm.util.StringHelper; | ||
import org.testng.annotations.Test; | ||
|
||
import static org.testng.Assert.assertNotNull; | ||
|
||
/** | ||
* @author Yuriy Z | ||
*/ | ||
public class FileProcessorTest { | ||
|
||
@Test | ||
public void simpleFilter_whenRun_shouldProduceFilter() { | ||
final Filter filter = Filter.createEqualityFilter(Filter.createLowercaseFilter("uid"), StringHelper.toLowerCase("1")); | ||
FilterProcessor filterProcessor = new FilterProcessor(); | ||
assertNotNull(filterProcessor.excludeFilter(filter, FilterProcessor.OBJECT_CLASS_EQUALITY_FILTER, FilterProcessor.OBJECT_CLASS_PRESENCE_FILTER)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > | ||
|
||
<suite name="ormFilter" parallel="false"> | ||
|
||
<test name="UnitTests" enabled="true"> | ||
<classes> | ||
<class name="io.jans.orm.search.filter.FileProcessorTest"/> | ||
</classes> | ||
</test> | ||
|
||
</suite> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
jans-orm/util/src/test/java/io/jans/orm/util/StringHelperTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package io.jans.orm.util; | ||
|
||
import org.testng.annotations.Test; | ||
|
||
import static org.testng.Assert.assertTrue; | ||
import static org.testng.Assert.assertFalse; | ||
|
||
/** | ||
* @author Yuriy Z | ||
*/ | ||
public class StringHelperTest { | ||
|
||
@Test | ||
public void isEmptyString_forNull_shouldReturnTrue() { | ||
assertTrue(StringHelper.isEmptyString(null)); | ||
} | ||
|
||
@Test | ||
public void isEmptyString_forEmptyString_shouldReturnTrue() { | ||
assertTrue(StringHelper.isEmptyString("")); | ||
} | ||
|
||
@Test | ||
public void isEmptyString_forNonEmptyString_shouldReturnFalse() { | ||
assertFalse(StringHelper.isEmptyString("df")); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > | ||
|
||
<suite name="ormUtil" parallel="false"> | ||
|
||
<test name="UnitTests" enabled="true"> | ||
<classes> | ||
<class name="io.jans.orm.util.StringHelperTest"/> | ||
</classes> | ||
</test> | ||
|
||
</suite> |