Skip to content

jabau/insist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

insist

LICENSE semver Build Status Maven Central

Insist is a framework for enforcing value invariants using a fluent API and hamcrest matchers.

import static io.github.jabau.insist.Insistence.insist;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.Matchers.notNullValue;

class Example {
    final String name;

    Example(String name) {
        this.name = insist("name", name)
                        .is(notNullValue())
                        .value();
    }

    Integer squareIfInteger(Object x) {
        insist(x).is(notNullValue()).is(instanceOf(Integer.class));
        final Integer i = (Integer) x;
        return i*i;
    }
}

Requirements

For building the library you need:

Building and installing the library locally

mvn install

Changelog

See the CHANGELOG file.

Copyright

Released under the MIT License. See the LICENSE file.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages