mirror of
https://github.com/Qortal/qortal.git
synced 2025-04-16 16:15:53 +00:00
implemented before and after filtering
This commit is contained in:
parent
dbf49309ec
commit
e76694e214
@ -183,6 +183,14 @@ public class HSQLDBCacheUtils {
|
|||||||
// retain only candidates with names
|
// retain only candidates with names
|
||||||
Stream<ArbitraryResourceData> stream = candidates.stream().filter(candidate -> candidate.name != null );
|
Stream<ArbitraryResourceData> stream = candidates.stream().filter(candidate -> candidate.name != null );
|
||||||
|
|
||||||
|
if(after.isPresent()) {
|
||||||
|
stream = stream.filter( candidate -> candidate.created > after.get().longValue() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if(before.isPresent()) {
|
||||||
|
stream = stream.filter( candidate -> candidate.created < before.get().longValue() );
|
||||||
|
}
|
||||||
|
|
||||||
if(exclude.isPresent())
|
if(exclude.isPresent())
|
||||||
stream = stream.filter( candidate -> !exclude.get().get().contains( candidate.name ));
|
stream = stream.filter( candidate -> !exclude.get().get().contains( candidate.name ));
|
||||||
|
|
||||||
|
@ -300,6 +300,19 @@ public class HSQLDBCacheUtilsTests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAfterNegative() {
|
||||||
|
ArbitraryResourceData data = new ArbitraryResourceData();
|
||||||
|
data.created = 10L;
|
||||||
|
data.name = "Joe";
|
||||||
|
|
||||||
|
filterListByMap(
|
||||||
|
List.of(data),
|
||||||
|
NAME_LEVEL, new HashMap<>(Map.of(AFTER, 11L)),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBeforePositive(){
|
public void testBeforePositive(){
|
||||||
ArbitraryResourceData data = new ArbitraryResourceData();
|
ArbitraryResourceData data = new ArbitraryResourceData();
|
||||||
@ -313,6 +326,19 @@ public class HSQLDBCacheUtilsTests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBeforeNegative(){
|
||||||
|
ArbitraryResourceData data = new ArbitraryResourceData();
|
||||||
|
data.created = 10L;
|
||||||
|
data.name = "Joe";
|
||||||
|
|
||||||
|
filterListByMap(
|
||||||
|
List.of(data),
|
||||||
|
NAME_LEVEL, new HashMap<>(Map.of(BEFORE, 9L)),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTitlePositive() {
|
public void testTitlePositive() {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user