Skip to content

vn-linescode/ToRuntime

 
 

Repository files navigation

Download Build Status codecov

Improve test coverage by trapping and promoting tricky checked exceptions you don't really expect or can't handle.

Install

Use either of these repositories:

repositories {
    jcenter()
}

or:

repositories {
    maven {
        url 'https://dl.bintray.com/novacrypto/General/'
    }
}

Add dependency:

dependencies {
    compile 'io.github.novacrypto:ToRuntime:0.9.0@jar'
}

Usage

Migrate from:

Result result;
try {
    result = somethingThatThrowsChecked();
} catch (TheChecked checked) {
    throw new RuntimeException(checked); // tricky to cover this line
}

To:

import static io.github.novacrypto.toruntime.CheckedExceptionToRuntime.toRuntime;
Result result = toRuntime(() -> somethingThatThrowsChecked());

About

Promote checked exceptions to runtime exceptions

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%