]
Mickael Istria commented on JBIDE-12972:
----------------------------------------
We don't want to add things that people could use in TP, we really to add things that
people want or need to use, so that it's sure they will use them.
So [~mgagyi], do you want or need festassert? Will you use it if we introduce it in TP?
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/...
and
https://repository.jboss.org/nexus/content/groups/public/org/easytesting/...)
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