Skip to content

OwenMcDonnell/tacinga

Repository files navigation

DevOps By Rultor.com

Build status Maven Central License License

Average time to resolve an issue Percentage of issues still open

ATTENTION: We're still in a very early alpha version, the API may and will change frequently. Please, use it at your own risk.

Tacinga is an Object-Oriented Java unit testing library.

Motivation. We are not happy with JUnit and TestNG because they are procedural and not object-oriented. They do their job, but do not use the Elegant Objects approach.

Principles. These are the design principles behind Tacinga.

Dependencies. This software uses these dependencies:

How to use. All you need is this (get the latest version here):

<dependency>
  <groupId>com.ashtonhogan</groupId>
  <artifactId>tacinga</artifactId>
</dependency>

Java version required: 1.9+.

StackOverflow tag is cactoos.

Support. These are the support principles behind Tacinga.

Contributions. These are the contribution principles behind Tacinga.

License. These are the license principles behind Tacinga.

  • The MIT license applies while you're not using the software for any commercial activity
  • Our commercial license applies when you use the software for any commercial activity

How to buy a commercial license. It is really easy to buy a commercial license:

  • All licenses types include all future 0.x.x versions
  • If you have a small or medium size business with 1-49 people then buy a basic license for $49
  • If you have a large size business with 50 or more people then buy an enterprise license for $1999
  • Note: Please keep your purchase receipt as evidence of your payment in future
  • Note: Your license may be annulled if we cannot reach you using the contact details provided

Usage

First create a new class and implement one of the Unit interfaces. Let's say you implement ObjectUnit - you will then need to implement a few methods as demonstrated here:

@Override
public FailureText failureText() throws Exception {
    return new FailureText(
            this.causeText,
            new ExpectedText(
                new PrefixText(PREFIX),
                new TextOf(this.string)
            ),
            new ActualText(
                new PrefixText(PREFIX),
                this.text
            )
    );
}
@Override
public Object expected() throws Exception {
    return this.string;
}
@Override
public Object actual() throws Exception {
    return this.text.asString();
}

Next, you create a test class. There are a number of testing conditions available. Below are some demonstrations on how to use them.

Test for null:

new ThatAssert(
        new ObjectiveText("Convert to null test"),
        new NullCondition(
                new TextHasNull(
                        new CauseText("Text did not return null"),
                        new PrefixText("Text with"),
                        new NullText(new TextOf("HelLo!")),
                        null
                )
        )
).evaluate();

Test object equality:

new ThatAssert(
        new ObjectiveText("Convert to lower case test"),
        new EqualCondition(
                new TextHasString(
                        new CauseText("Can't lower case a text"),
                        new PrefixText("Text with"),
                        new LowerText(new TextOf("HelLo!")),
                        "hello!"
                )
        )
).evaluate();

About

Object-Oriented Java unit testing library, as an alternative to JUnit and TestNG http://www.tacinga.com

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages