Compare commits

...

1 Commits

Author SHA1 Message Date
Stephan Schroevers
cf80180103 Why doesn't this match? 2024-02-21 18:46:07 +01:00
2 changed files with 18 additions and 0 deletions

View File

@@ -23,6 +23,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Objects;
import java.util.Set;
import java.util.function.Supplier;
import java.util.stream.Stream;
import org.jspecify.annotations.Nullable;
import tech.picnic.errorprone.refaster.annotation.OnlineDocumentation;
@@ -35,6 +36,18 @@ import tech.picnic.errorprone.refaster.annotation.OnlineDocumentation;
final class AssortedRules {
private AssortedRules() {}
final class IllegalStateExceptionSupplier {
@BeforeTemplate
Supplier<IllegalStateException> before(String message) {
return () -> new IllegalStateException(message);
}
@AfterTemplate
Supplier<IllegalStateException> after(String message) {
return () -> new IllegalStateException("XXX");
}
}
/** Prefer {@link Objects#checkIndex(int, int)} over the Guava alternative. */
static final class CheckIndex {
@BeforeTemplate

View File

@@ -13,6 +13,7 @@ import com.google.common.collect.Streams;
import java.util.Collections;
import java.util.HashSet;
import java.util.stream.Stream;
import reactor.core.publisher.Mono;
import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
final class AssortedRulesTest implements RefasterRuleCollectionTestCase {
@@ -28,6 +29,10 @@ final class AssortedRulesTest implements RefasterRuleCollectionTestCase {
toImmutableSet());
}
Mono<Void> testIllegalStateExceptionSupplier() {
return Mono.error(() -> new IllegalStateException("ISE"));
}
int testCheckIndex() {
return Preconditions.checkElementIndex(0, 1);
}