Title: JUnit 4.9b2 (beta-)released

David Saff <[email protected]> Fri, 21 Jan 2011 20:55:20 -0500
Newsgroups gmane.comp.java.junit.user,gmane.comp.java.junit.devel
Message-ID <[email protected]>
Hello, everyone.  We're happy to announce the release of JUnit 4.9b2.
This release's theme is Test-class and suite level Rules.
More information linked from
http://saffgreenbar.blogspot.com/2011/01/junit-49b2-beta-released.html,
and release notes below.
Share and enjoy, and please try it out and give us feedback.  Thanks,

Your friendly neighborhood JUnit maintainers


## Summary of Changes in version 4.9 [unreleased!] ##

Release theme: Test-class and suite level Rules.

### ClassRule ###

The `ClassRule` annotation extends the idea of method-level Rules,
adding static fields that can affect the operation of a whole class.  Any
subclass of `ParentRunner`, including the standard `BlockJUnit4ClassRunner`
and `Suite` classes, will support `ClassRule`s.

For example, here is a test suite that connects to a server once before
all the test classes run, and disconnects after they are finished:

	@RunWith(Suite.class)
	@SuiteClasses({A.class, B.class, C.class})
	public class UsesExternalResource {
		public static Server myServer= new Server();
	
		@Rule
		public static ExternalResource resource= new ExternalResource() {
			@Override
			protected void before() throws Throwable {
				myServer.connect();
			};
	
			@Override
			protected void after() {
				myServer.disconnect();
			};
		};
	}

### TestRule ###

In JUnit 4.9, fields that can be annotated with either `@Rule` or `@ClassRule`
should be of type `TestRule`.  The old `MethodRule` type, which only made sense
for method-level rules, will still work, but is deprecated.

Most built-in Rules have been moved to the new type already, in a way that
should be transparent to most users.  `TestWatchman` has been deprecated,
and replaced by `TestWatcher`, which has the same functionality, but implements
the new type.

`TestRule` is an abstract base class, and its abstract `apply` method is
protected.  In order to apply `TestRule`s to a `Statement`, use the `RunRules`
class in `org.junit.rules` (thanks to `@kcooney`)

### LICENSE checked in ###

The Common Public License that JUnit is released under is now included
in the source repository.

### Bug fixes ###

- github#98: assumeTrue() does not work with expected exceptions
- github#74: Categories + Parameterized

  In JUnit 4.8.2, the Categories runner would fail to run correctly
  if any contained test class had a custom Runner with a structure
  significantly different from the built-in Runner.  With this fix,
  such classes can be assigned one or more categories at the class level,
  and will be run correctly.  Trying to assign categories to methods within
  such a class will flag an error.

- github#163: Bad comparison failure message when using
assertEquals(String, String)

  Thanks to `@kcooney`

### Minor changes ###

- Backed out unused folder "experimental-use-of-antunit", replaced by
  bash-based script at build_tests.sh

- Made MultipleFailureException public, to assist extension writers.
  Thanks to `@kcooney`


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/junit/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/junit/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected] 
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/