Skip to content

Commit

Permalink
Update TCK tests to have repository method return types that are supp…
Browse files Browse the repository at this point in the history
…orted by the spec
  • Loading branch information
njr-11 committed Mar 5, 2024
1 parent 69f4698 commit 1465827
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package ee.jakarta.tck.data.framework.read.only;

import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.Set;
Expand Down Expand Up @@ -50,7 +49,7 @@ public interface AsciiCharacters extends DataRepository<AsciiCharacter, Long>, I
Optional<AsciiCharacter> find(@By("thisCharacter") char ch,
@By("hexadecimal") String hex);

Collection<AsciiCharacter> findByHexadecimalContainsAndIsControlNot(String substring, boolean isPrintable);
List<AsciiCharacter> findByHexadecimalContainsAndIsControlNot(String substring, boolean isPrintable);

Stream<AsciiCharacter> findByHexadecimalIgnoreCaseBetweenAndHexadecimalNotIn(String minHex,
String maxHex,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
*/
package ee.jakarta.tck.data.framework.read.only;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.stream.Stream;

import jakarta.data.Limit;
Expand All @@ -31,11 +30,11 @@
public interface IdOperations<T> {
Stream<T> findByIdBetween(long minimum, long maximum, Sort<T> sort);

Collection<T> findByIdGreaterThanEqual(long minimum,
List<T> findByIdGreaterThanEqual(long minimum,
Limit limit,
Order<T> sorts);

T[] findByIdLessThan(long exclusiveMax, Sort<T> primarySort, Sort<T> secondarySort);

ArrayList<T> findByIdLessThanEqual(long maximum, Order<T> sorts);
List<T> findByIdLessThanEqual(long maximum, Order<T> sorts);
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ CursoredPage<NaturalNumber> findByFloorOfSquareRootNotAndIdLessThanOrderByBitsRe
long eclusiveMax,
PageRequest<NaturalNumber> pagination);

Iterable<NaturalNumber> findByIsOddTrueAndIdLessThanEqualOrderByIdDesc(long max);
List<NaturalNumber> findByIsOddTrueAndIdLessThanEqualOrderByIdDesc(long max);

List<NaturalNumber> findByIsOddFalseAndIdBetween(long min, long max);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ public interface Catalog extends DataRepository<Product, String> {
@OrderBy("name")
Product[] findByDepartmentsContains(Department department);

LinkedList<Product> findByDepartmentsEmpty();
Stream<Product> findByDepartmentsEmpty();

Iterable<Product> findByIdBetween(String first, String last, Order<Product> sorts);
List<Product> findByIdBetween(String first, String last, Order<Product> sorts);

List<Product> findByNameLike(String name);

Expand All @@ -88,7 +88,7 @@ public interface Catalog extends DataRepository<Product, String> {
@OrderBy(value = "price", descending = true)
Stream<Product> findByPriceNotNullAndPriceLessThanEqual(double maxPrice);

Collection<Product> findByPriceNull();
List<Product> findByPriceNull();

EntityManager getEntityManager();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,11 @@ public void testEmpty() {
catalog.save(Product.of("book", 15.98, "TEST-PROD-42"));
catalog.save(Product.of("baseball cap", 10.99, "TEST-PROD-43", Department.SPORTING_GOODS, Department.CLOTHING));

LinkedList<Product> found = catalog.findByDepartmentsEmpty();
Stream<Product> found = catalog.findByDepartmentsEmpty();

assertEquals(1, found.size());
assertEquals("book", found.getFirst().getName());
assertEquals(List.of("book"),
found.map(Product::getName)
.collect(Collectors.toList()));

assertEquals(3L, catalog.deleteByProductNumLike("TEST-PROD-%"));
}
Expand Down

0 comments on commit 1465827

Please sign in to comment.