Task 2 interface testing jabref
This commit is contained in:
parent
5da1a41b2b
commit
746ece4a42
@ -0,0 +1,14 @@
|
||||
package org.jabref.model.search.matchers;
|
||||
|
||||
import org.jabref.model.search.SearchMatcher;
|
||||
import org.jabref.model.search.rules.MockSearchMatcher;
|
||||
|
||||
public class AndMatcherTest extends SearchMatcherTest {
|
||||
@Override
|
||||
protected SearchMatcher makeMatcher() {
|
||||
MatcherSet matcherSet = MatcherSets.build(MatcherSets.MatcherType.AND);
|
||||
matcherSet.addRule(new MockSearchMatcher(true));
|
||||
matcherSet.addRule(new MockSearchMatcher(true));
|
||||
return matcherSet;
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package org.jabref.model.search.matchers;
|
||||
|
||||
import org.jabref.model.search.SearchMatcher;
|
||||
import org.jabref.model.search.rules.MockSearchMatcher;
|
||||
|
||||
public class NotAndMatcherTest extends SearchMatcherTest {
|
||||
@Override
|
||||
protected SearchMatcher makeMatcher() {
|
||||
MatcherSet matcherSet = MatcherSets.build(MatcherSets.MatcherType.AND);
|
||||
matcherSet.addRule(new MockSearchMatcher(true));
|
||||
matcherSet.addRule(new MockSearchMatcher(false));
|
||||
return new NotMatcher(matcherSet);
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package org.jabref.model.search.matchers;
|
||||
|
||||
import org.jabref.model.search.SearchMatcher;
|
||||
import org.jabref.model.search.rules.MockSearchMatcher;
|
||||
|
||||
|
||||
public class NotMatcherTest extends SearchMatcherTest {
|
||||
@Override
|
||||
protected SearchMatcher makeMatcher() {
|
||||
return new NotMatcher(new MockSearchMatcher(false));
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package org.jabref.model.search.matchers;
|
||||
|
||||
import org.jabref.model.search.SearchMatcher;
|
||||
import org.jabref.model.search.rules.MockSearchMatcher;
|
||||
|
||||
public class NotOrMatcherTest extends SearchMatcherTest {
|
||||
@Override
|
||||
protected SearchMatcher makeMatcher() {
|
||||
MatcherSet matcherSet = MatcherSets.build(MatcherSets.MatcherType.OR);
|
||||
matcherSet.addRule(new MockSearchMatcher(false));
|
||||
matcherSet.addRule(new MockSearchMatcher(false));
|
||||
return new NotMatcher(matcherSet);
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package org.jabref.model.search.matchers;
|
||||
|
||||
import org.jabref.model.search.SearchMatcher;
|
||||
import org.jabref.model.search.rules.MockSearchMatcher;
|
||||
|
||||
public class OrMatcherTest extends SearchMatcherTest {
|
||||
@Override
|
||||
protected SearchMatcher makeMatcher() {
|
||||
MatcherSet matcherSet = MatcherSets.build(MatcherSets.MatcherType.OR);
|
||||
matcherSet.addRule(new MockSearchMatcher(true));
|
||||
matcherSet.addRule(new MockSearchMatcher(true));
|
||||
return matcherSet;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package org.jabref.model.search.matchers;
|
||||
|
||||
import org.jabref.model.entry.BibEntry;
|
||||
import org.jabref.model.search.SearchMatcher;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public abstract class SearchMatcherTest {
|
||||
|
||||
private SearchMatcher matcher;
|
||||
protected abstract SearchMatcher makeMatcher();
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
matcher = makeMatcher();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsMatch() {
|
||||
assertTrue(matcher.isMatch(new BibEntry()));
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user