diff --git a/eo-runtime/src/main/java/org/eolang/Expect.java b/eo-runtime/src/main/java/org/eolang/Expect.java index 423102f49a..dc266506e0 100644 --- a/eo-runtime/src/main/java/org/eolang/Expect.java +++ b/eo-runtime/src/main/java/org/eolang/Expect.java @@ -34,7 +34,7 @@ * @param The type of result * @since 0.41.0 */ -@SuppressWarnings({"PMD.ShortMethodName", "PMD.UnnecessaryFullyQualifiedName"}) +@SuppressWarnings("PMD.ShortMethodName") public class Expect { /** @@ -248,7 +248,7 @@ public Double it() { * * @since 0.51 */ - public static final class Integer { + public static final class Int { /** * Expect. @@ -259,7 +259,7 @@ public static final class Integer { * Ctor. * @param expect Expect */ - public Integer(final Expect expect) { + public Int(final Expect expect) { this.expect = expect; } @@ -268,7 +268,7 @@ public Integer(final Expect expect) { * @return The token * @checkstyle MethodNameCheck (5 lines) */ - public java.lang.Integer it() { + public Integer it() { return this.expect .that(phi -> new Dataized(phi).asNumber()) .otherwise("must be a number") @@ -280,11 +280,12 @@ public java.lang.Integer it() { } /** - * Transform Expect to NonNegativeInteger. + * Transform Expect to Natural number. + * Natural number is integer greater or equal to zero. * * @since 0.51 */ - public static final class NonNegativeInteger { + public static final class Natural { /** * Expect. @@ -295,7 +296,7 @@ public static final class NonNegativeInteger { * Ctor. * @param expect Expect */ - public NonNegativeInteger(final Expect expect) { + public Natural(final Expect expect) { this.expect = expect; } @@ -304,7 +305,7 @@ public NonNegativeInteger(final Expect expect) { * @return The token * @checkstyle MethodNameCheck (5 lines) */ - public java.lang.Integer it() { + public Integer it() { return this.expect .that(phi -> new Dataized(phi).asNumber()) .otherwise("must be a number") diff --git a/eo-runtime/src/test/java/org/eolang/ExpectTest.java b/eo-runtime/src/test/java/org/eolang/ExpectTest.java index a37014a8c5..6b1fa81880 100644 --- a/eo-runtime/src/test/java/org/eolang/ExpectTest.java +++ b/eo-runtime/src/test/java/org/eolang/ExpectTest.java @@ -192,7 +192,7 @@ void failsInTransformingToIntegerForNotNumber() { "inner class Integer throws error for not a number", Assertions.assertThrows( ExFailure.class, - () -> new Expect.Integer( + () -> new Expect.Int( Expect.at( new PhWith( new PhDefault(), @@ -214,7 +214,7 @@ void failsInTransformingToIntegerForNotInteger() { "inner class Integer throws error for not an integer number", Assertions.assertThrows( ExFailure.class, - () -> new Expect.Integer( + () -> new Expect.Int( Expect.at( new PhWith( new PhDefault(), @@ -236,7 +236,7 @@ void failsInTransformingToNonNegativeIntegerForNotNumber() { "inner class NonNegativeInteger throws error for not a number", Assertions.assertThrows( ExFailure.class, - () -> new Expect.NonNegativeInteger( + () -> new Expect.Natural( Expect.at( new PhWith( new PhDefault(), @@ -258,7 +258,7 @@ void failsInTransformingToNonNegativeIntegerForNotInteger() { "inner class NonNegativeInteger throws error for not an integer number", Assertions.assertThrows( ExFailure.class, - () -> new Expect.NonNegativeInteger( + () -> new Expect.Natural( Expect.at( new PhWith( new PhDefault(), @@ -280,7 +280,7 @@ void failsInTransformingToNonNegativeIntegerForNegative() { "inner class NonNegativeInteger throws error for a negative integer", Assertions.assertThrows( ExFailure.class, - () -> new Expect.NonNegativeInteger( + () -> new Expect.Natural( Expect.at( new PhWith( new PhDefault(),