[jbosstools-issues] [JBoss JIRA] (JBIDE-19220) Add AssertJ to the TP

Xavier Coulon (JIRA) issues at jboss.org
Wed Feb 11 03:57:49 EST 2015


Xavier Coulon created JBIDE-19220:
-------------------------------------

             Summary: Add AssertJ to the TP
                 Key: JBIDE-19220
                 URL: https://issues.jboss.org/browse/JBIDE-19220
             Project: Tools (JBoss Tools)
          Issue Type: Feature Request
          Components: target-platform
            Reporter: Xavier Coulon
            Assignee: Xavier Coulon
            Priority: Minor
             Fix For: 4.2.x


It would be great if we could use  in our tests. We would have to add it to our target platform (TP) for our plugins to use it.

Reason: FestAssert provides us with a Fluent API to write test assertions.

License and owner: Apache License 2.0 / http://code.google.com/p/fest/

Original repository: (not an Eclipse bundle yet). Source and binaries available on Maven (https://repository.jboss.org/nexus/content/groups/public/org/easytesting/fest-assert/1.4/ and https://repository.jboss.org/nexus/content/groups/public/org/easytesting/fest-util/1.1.6/)

JBoss Mirrored repository: http://downloads.jboss.org/jbosstools/updates/requirements/fest-assert ?

Source: https://github.com/alexruiz/fest-assert-1.x

Affected projects: LiveReload for now, JAX-RS in the future

Required in devstudio: No for now (if LiveReload is considered incubation)

Type of dependency: testing

List of bundles added/removed: fest-assert, fest-util



Fest-assert provides a fluent API to perform asertions in JUnit tests. It is also nice to use when the objects to tests are collections.

To convince you of the interest of fest-assert, here are a few syntax examples:

- In LiveReload-test plugin:
{code}
assertThat(new String(modifiedContent)).doesNotContain(addition + "</body>");
{code}


- a more complete example of usage in openShift-java-client (not an Eclipse plugin, though, but it gives an idea of the chained assertions that can be performed)
{code}
assertThat(new GearGroupsAssert(gearGroups))
				.assertGroup(0).hasUUID().hasGears()
				.assertGear(0).hasId().hasState();
{code}

- in case of assertion failure on such a statement:
{code}
Assertions.assertThat(commands).hasSize(2);
{code}
the exception message will look like this:
{code}
java.lang.AssertionError: expected size:<2> but was:<1> for <['{"command":"reload","path":null,"liveCSS":true}']>
	at org.fest.assertions.Fail.failure(Fail.java:228)
	at org.fest.assertions.Assert.failure(Assert.java:149)
	at org.fest.assertions.GroupAssert.hasSize(GroupAssert.java:89)
	at org.jboss.tools.livereload.internal.service.LiveReloadCommandGeneratorTestCase.shouldGenerateCommandForIndexHtmlFileAfterSingleChange(LiveReloadCommandGeneratorTestCase.java:45)
	at ...
{code}

See more examples here: http://code.google.com/p/fest/#Fluent_Assertions








--
This message was sent by Atlassian JIRA
(v6.3.11#6341)


More information about the jbosstools-issues mailing list