File tree 2 files changed +4
-3
lines changed
main/java/tech/pegasys/teku/validator/api
test/java/tech/pegasys/teku/validator/api
2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ private Optional<String> updateGraffiti(final BLSPublicKey publicKey) {
58
58
private Optional <String > updateGraffiti (final BLSPublicKey publicKey , final String graffiti ) {
59
59
final int graffitiSize = graffiti .getBytes (StandardCharsets .UTF_8 ).length ;
60
60
if (graffitiSize > 32 ) {
61
- return Optional . of (
61
+ throw new IllegalArgumentException (
62
62
String .format (
63
63
"'%s' converts to %s bytes. Input must be 32 bytes or less." ,
64
64
graffiti , graffitiSize ));
Original file line number Diff line number Diff line change @@ -97,8 +97,9 @@ void setGraffiti_shouldThrowExceptionWhenGraffitiTooBig(@TempDir final Path temp
97
97
manager = new GraffitiManager (dataDirLayout );
98
98
assertThat (getGraffitiManagementDir ().toFile ().exists ()).isTrue ();
99
99
100
- assertThat (manager .setGraffiti (publicKey , invalidGraffiti ))
101
- .hasValue (
100
+ assertThatThrownBy (() -> manager .setGraffiti (publicKey , invalidGraffiti ))
101
+ .isInstanceOf (IllegalArgumentException .class )
102
+ .hasMessage (
102
103
"'This graffiti is a bit too long!!' converts to 33 bytes. Input must be 32 bytes or less." );
103
104
}
104
105
You can’t perform that action at this time.
0 commit comments