mirror of
https://github.com/Qortal/qortal.git
synced 2025-04-14 23:35:54 +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
|
||||
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())
|
||||
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
|
||||
public void testBeforePositive(){
|
||||
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
|
||||
public void testTitlePositive() {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user