Skip to content

Negation in conditions #32

@karol-bujacek

Description

@karol-bujacek

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");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions