noexcuses

Mockito extension to make unit testing simple POJOs less tedious.

License

License

GroupId

GroupId

com.tacitknowledge
ArtifactId

ArtifactId

noexcuses
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

noexcuses
Mockito extension to make unit testing simple POJOs less tedious.
Project Organization

Project Organization

Tacit Knowledge
Source Code Management

Source Code Management

https://github.com/tacitknowledge/noexcuses

Download noexcuses

How to add to project

<!-- https://jarcasting.com/artifacts/com.tacitknowledge/noexcuses/ -->
<dependency>
    <groupId>com.tacitknowledge</groupId>
    <artifactId>noexcuses</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.tacitknowledge/noexcuses/
implementation 'com.tacitknowledge:noexcuses:1.1.0'
// https://jarcasting.com/artifacts/com.tacitknowledge/noexcuses/
implementation ("com.tacitknowledge:noexcuses:1.1.0")
'com.tacitknowledge:noexcuses:jar:1.1.0'
<dependency org="com.tacitknowledge" name="noexcuses" rev="1.1.0">
  <artifact name="noexcuses" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.tacitknowledge', module='noexcuses', version='1.1.0')
)
libraryDependencies += "com.tacitknowledge" % "noexcuses" % "1.1.0"
[com.tacitknowledge/noexcuses "1.1.0"]

Dependencies

compile (3)

Group / Artifact Type Version
junit : junit jar 4.10
org.mockito : mockito-all jar 1.9.0
commons-lang : commons-lang jar 2.6

Project Modules

There are no modules declared in this project.

noexcuses Build Status

noexcuses is a mockito extension created to make unit testing simple getters, setters, and constructors less tedious.

Why noexcuses?

Purists would say we need 100% coverage and all tests need to be solid. On the other end of the spectrum, many teams settle for 70-80% coverage because writing tests for accessors/mutators and constructors seem a waste of time. They consider them a waste of time because those portions of the codebase are extremely low risk in terms of potential bugs. noexcuses is a way of finding a middle ground with an extra added benefit. noexcuses works in combination with coverage tools like emma or cobertura.

Basically, using it filters out coverage gaps on low risk methods so that the only methods that appear on coverage reports are high risk methods. This helps guide us in our craft.

Samples - use mockito and reflection to cover low risk methods

Getters and Setters:

public void testGetterAndSetterConvenienceMethodWithExclusions() throws Exception {
    DummyObject object = new DummyObject();
    MethodTester methodTester = new MethodTester();
//exclude certain methods with an exclusion array.
    methodTester.performGettersAndSetters(object,new String[]{"getSomething"});

}

Methods:

    public void testAllMethodsWithGetPrefix() throws Exception {
        DummyObject object = new DummyObject();
        MethodTester methodTester = new MethodTester("get");
        methodTester.performTest(object);
    }

Constructors:

    public void testConstructors() throws Exception {
	//tries all consutrctors on DummyObject
        TestManager.testConstruction(DummyObject.class);
    }

Start Using noexcuses

You can include noexcuses in your Maven project via:

<dependency>
	<groupId>com.tacitknowledge</groupId>
	<artifactId>noexcuses</artifactId>
	<version>1.1.0</version>
</dependency>

Licensing

This framework is released under Apache 2.0 Public License.
The text of the license you can find at http://www.apache.org/licenses/LICENSE-2.0.txt.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
com.tacitknowledge

Tacit Knowledge

Versions

Version
1.1.0