more tests

This commit is contained in:
Athou
2014-12-18 16:31:35 +01:00
parent 68cb8e194d
commit a96862fffa
2 changed files with 12 additions and 6 deletions

View File

@@ -38,11 +38,6 @@ public class FeedEntryFilteringService {
private static JexlEngine initEngine() {
// classloader that prevents object creation
ClassLoader cl = new ClassLoader() {
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
return null;
}
@Override
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
return null;

View File

@@ -42,7 +42,7 @@ public class FeedEntryFilteringServiceTest {
@Test
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)
@@ -67,8 +67,19 @@ public class FeedEntryFilteringServiceTest {
@Test
public void handlesNullCorrectly() throws FeedEntryFilterException {
entry.setUrl(null);
entry.setContent(new FeedEntryContent());
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);
}
}