forked from Archives/Athou_commafeed
more tests
This commit is contained in:
@@ -38,11 +38,6 @@ public class FeedEntryFilteringService {
|
|||||||
private static JexlEngine initEngine() {
|
private static JexlEngine initEngine() {
|
||||||
// classloader that prevents object creation
|
// classloader that prevents object creation
|
||||||
ClassLoader cl = new ClassLoader() {
|
ClassLoader cl = new ClassLoader() {
|
||||||
@Override
|
|
||||||
public Class<?> loadClass(String name) throws ClassNotFoundException {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
|
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class FeedEntryFilteringServiceTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void simpleExpression() throws FeedEntryFilterException {
|
public void simpleExpression() throws FeedEntryFilterException {
|
||||||
Assert.assertTrue(service.filterMatchesEntry("author eq 'athou'", entry));
|
Assert.assertTrue(service.filterMatchesEntry("author.toString() eq 'athou'", entry));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = FeedEntryFilterException.class)
|
@Test(expected = FeedEntryFilterException.class)
|
||||||
@@ -67,8 +67,19 @@ public class FeedEntryFilteringServiceTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void handlesNullCorrectly() throws FeedEntryFilterException {
|
public void handlesNullCorrectly() throws FeedEntryFilterException {
|
||||||
|
entry.setUrl(null);
|
||||||
entry.setContent(new FeedEntryContent());
|
entry.setContent(new FeedEntryContent());
|
||||||
service.filterMatchesEntry("author eq 'athou'", entry);
|
service.filterMatchesEntry("author eq 'athou'", entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(expected = FeedEntryFilterException.class)
|
||||||
|
public void incorrectScriptThrowsException() throws FeedEntryFilterException {
|
||||||
|
service.filterMatchesEntry("aa eqz bb", entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(expected = FeedEntryFilterException.class)
|
||||||
|
public void incorrectReturnTypeThrowsException() throws FeedEntryFilterException {
|
||||||
|
service.filterMatchesEntry("1", entry);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user