Skip to content

Commit

Permalink
Fix compiler warnings in test code
Browse files Browse the repository at this point in the history
  • Loading branch information
runeflobakk committed Sep 26, 2024
1 parent 4afb470 commit a61ac1d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/test/java/no/digipost/DiggBaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ public void useArbitraryObjectWithTryWithResources(@Mock MyResource resource) {

interface MyAutoCloseableResource extends AutoCloseable {
void done() throws IOException;
@Override
void close() throws RuntimeException;
}

@Test
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/no/digipost/DiggEnumsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void convertFromCommaSeparatedListOfEnumNames() {

qt()
.forAll(multipleEnums)
.asWithPrecursor(enums -> Stream.of(enums).map(Enum::name).collect(joining(" , ", " ", " ")))
.asWithPrecursor(enums -> Stream.of(enums).map(MyEnum::name).collect(joining(" , ", " ", " ")))
.checkAssert((enums, commaSeparatedNames) -> assertThat(fromCommaSeparatedNames(commaSeparatedNames, MyEnum.class), contains(enums)));

}
Expand All @@ -74,11 +74,11 @@ public void convertToStringOfDelimiterSeparatedStrings() {
public void toStringConversionsAreSpecialCasesOfTheGenericBaseCase() {
qt()
.forAll(multipleEnums)
.check(enums -> toCommaSeparatedNames(enums).equals(toStringOf(Enum::name, joining(","), enums)));
.check(enums -> toCommaSeparatedNames(enums).equals(toStringOf(MyEnum::name, joining(","), enums)));

qt()
.forAll(multipleEnums)
.check(enums -> toNames(": ", enums).equals(toStringOf(Enum::name, joining(": "), enums)));
.check(enums -> toNames(": ", enums).equals(toStringOf(MyEnum::name, joining(": "), enums)));

qt()
.forAll(multipleEnums)
Expand Down
6 changes: 4 additions & 2 deletions src/test/java/no/digipost/collection/BatchedIterableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ class BatchedIterableTest {

@Test
void emptyBatch() {
Batches<Object> empty1 = new Batches<>();
@SuppressWarnings("unchecked")
Batches<?> empty1 = new Batches<>();
assertThat(batched(empty1, b -> false), is(emptyIterable()));
assertThat(empty1.fetches(), is(1));

Batches<Object> empty2 = new Batches<>();
@SuppressWarnings("unchecked")
Batches<?> empty2 = new Batches<>();
assertThat(batched(empty2, b -> true), is(emptyIterable()));
assertThat(empty2.fetches(), is(2));
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/no/digipost/io/InputStreamIteratorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void throws_if_next_is_called_with_no_more_elements() throws Exception {
InputStreamIterator iterator = new InputStreamIterator(inputStream, 2);

assertThat(consumeToString(iterator, UTF_8), is("Some data"));
assertThat(iterator, whereNot(Iterator::hasNext));
assertThat(iterator, whereNot(Iterator<byte[]>::hasNext));

assertThrows(NoSuchElementException.class, iterator::next);
}
Expand Down

0 comments on commit a61ac1d

Please sign in to comment.