|
From: Alistair I. <ai...@gm...> - 2009-10-26 23:55:36
|
On Mon, Oct 26, 2009 at 9:51 PM, David Saff <da...@sa...> wrote: > Note that we can get the "one object" behavior with the "two annotations" API: > > @ClassRule > public static RemoteTestWatchman watchman = new RemoteTestWatchman(); > > @Rule public RemoteTestWatchman methodWatchman = watchman; Well, yeah I suppose that would work. Or you could simply annotate the same field twice. I guess ultimately it's a design decision. Personally, I like having fewer annotations and letting the framework figure out my intent, following published 'conventions', if need be. I can see others, though, favoring explicit declarations of method-level rules vs. class-level rules. Since JUnit rules have only been out, oh, a couple of months(?) it remains to be seen how others might use them and prefer to handle class rules. I've given my opinions for the record. I don't see anything wrong with going either way and "failing fast"—after all, seeing the history of JUnit you guys haven't been loathe to introduce something then deprecate it soon enough afterward if something else made better sense. - alistair -- http://alistairisrael.wordpress.com |