Use Assert.state() where appropriate

This commit is contained in:
Sam Brannen
2022-11-14 17:36:11 +01:00
parent 2aa78889d2
commit abf3400c07
30 changed files with 80 additions and 82 deletions

View File

@@ -30,6 +30,7 @@ import org.springframework.lang.Nullable;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
/**
* Tests for {@link DefaultMethodReference}.
@@ -86,7 +87,7 @@ class DefaultMethodReferenceTests {
void toCodeBlockWithStaticMethodRequiresDeclaringClass() {
MethodSpec method = createTestMethod("methodName", new TypeName[0], Modifier.STATIC);
MethodReference methodReference = new DefaultMethodReference(method, null);
assertThatIllegalArgumentException().isThrownBy(methodReference::toCodeBlock)
assertThatIllegalStateException().isThrownBy(methodReference::toCodeBlock)
.withMessage("static method reference must define a declaring class");
}