Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.tanob:groobe:'
}
dependencies {
implementation("com.github.tanob:groobe:")
}
<dependency>
<groupId>com.github.tanob</groupId>
<artifactId>groobe</artifactId>
<version></version>
</dependency>
libraryDependencies += "com.github.tanob" % "groobe" % ""
:dependencies [[com.github.tanob/groobe ""]]
GrooBe allows you to use should-be assertions on Groovy unit tests. At the moment we support the following:
Equality assertions
shouldBe and shouldNotBeshouldEqual and shouldNotEqualshouldBeEqual and shouldNotBeEqualshouldBeEqualTo and shouldNotBeEqualToInstance assertions
shouldBeA and shouldBeAn, with the respective shouldNotBeA and shouldNotBeAnComparable assertions
shouldBeGreaterThanshouldBeLessThanString assertions
shouldStartWith and shouldNotStartWithshouldEndWith and shouldNotEndWithshouldContain and shouldNotContainshouldBeEmpty and shouldNotBeEmptyMap assertions
shouldHaveKey and shouldNotHaveKeyshouldHaveValue and shouldNotHaveValueshouldHaveEntry and shouldNotHaveEntryshouldBeEmpty and shouldNotBeEmptyCollection assertions
shouldContain and shouldNotContainshouldBeEmpty and shouldNotBeEmptyClosure assertions
shouldFailWithJust add GrooBe as a dependency on your Maven pom.xml file:
<dependency>
<groupId>com.github.tanob</groupId>
<artifactId>groobe</artifactId>
<version>1.1</version>
</dependency>
Being based on the hamcrest test expressions allows GrooBe to be used with JUnit or TestNG.
Here is an example of how you use it with JUnit4, there are several other examples in the src/test directory:
import com.github.tanob.groobe.GrooBe
import org.junit.Before
import org.junit.Test
public class ExampleTest {
@Before
public void before() {
GrooBe.activate()
}
@Test
public void someShouldBeAssertions() {
(2*2).shouldNotBe 5
1.shouldBeAn Integer
"a different string".shouldNotContain "the same string"
}
}
I would like to thank Paul Hammant (http://paulhammant.com/) for all his help and for suggesting the name GrooBe for the project.
We use a BSD license as you can see in our LICENSE.txt.