Dear @m4ndr4ck,
Can you, please, check these lines? It looks to me that one of the conditions should be negated.
CIDR specification is satisfied if integer value is greater than constant value.
Network availability specification is the same case – network is available if the router is present (not null) and the network is available.
Network availability condition result is negated in the condition, the CIDR is not. The fix were added in the commit f7d2664 (after TR feedback).
Availability result is negated only here in the code, not in the book (both in the PDF version of the first edition, and online versions for first and second edition).
|
if(cidrSpec.isSatisfiedBy(network.getCidr())) |
|
throw new IllegalArgumentException("CIDR is below "+CIDRSpecification.MINIMUM_ALLOWED_CIDR); |
|
|
|
if(!availabilitySpec.isSatisfiedBy(router)) |
|
throw new IllegalArgumentException("Address already exist"); |
Dear @m4ndr4ck,
Can you, please, check these lines? It looks to me that one of the conditions should be negated.
CIDR specification is satisfied if integer value is greater than constant value.
Network availability specification is the same case – network is available if the router is present (not null) and the network is available.
Network availability condition result is negated in the condition, the CIDR is not. The fix were added in the commit f7d2664 (after TR feedback).
Availability result is negated only here in the code, not in the book (both in the PDF version of the first edition, and online versions for first and second edition).
Designing-Hexagonal-Architecture-with-Java/Chapter02/src/main/java/dev/davivieira/domain/service/NetworkOperation.java
Lines 19 to 23 in 8d702ae