[jbosstools-issues] [JBoss JIRA] (JBIDE-12972) Add FestAssert to the TP

Andre Dietisheim (JIRA) issues at jboss.org
Fri Feb 6 11:18:50 EST 2015


    [ https://issues.jboss.org/browse/JBIDE-12972?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13038429#comment-13038429 ] 

Andre Dietisheim commented on JBIDE-12972:
------------------------------------------

[~mgagyi] Matej, is this something that you could use in your test? FestAssert adds nice syntactic sugar to assertions, my guess is that this is something that you could nicely use when doing tests? If yes, then what about trying this out and report to [~nickboldt]?

> Add FestAssert to the TP
> ------------------------
>
>                 Key: JBIDE-12972
>                 URL: https://issues.jboss.org/browse/JBIDE-12972
>             Project: Tools (JBoss Tools)
>          Issue Type: Feature Request
>          Components: target-platform
>    Affects Versions: 4.0.0.Beta1
>            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