Hi Ron,
On 18/04/2012, at 08:06, Ron X wrote:
> What is the meaning of using @UnderTest?
The @UnderTest annotation can be used to create real enterprise objects and
insert them into the editing context rule. It is a shorthand for:
public class SongTest {
...
private Song song;
@Before
public void setup() {
foo = Song.createFoo(ec);
}
...
}
The WOUnit User's Guide [1] contains a step-by-step explanation of the problem
solved by the @UnderTest annotation. See the "@Dummy and @UnderTest
Annotations" section for details.
> it can be omitted and using mock(<entity>).
No, it can't. A fake object is created when you use the mock() method. The
@UnderTest annotation creates and inserts a real enterprise object in the
MockEditingContext.
> when i do confirm(song, canBeSaved()); - it falls with exception
Mock objects created with Mockito are not intended to work with the WOUnit's
assertions.
> but when i do:
> mock(Song.class);
> and than do confirm(song, canBeSaved());
> everything works fine
>
It's just coincidence. The mock Song created by Mockito doesn't throw any
exception when the validateForSave() method is called. Then, the canBeSaved()
assertion seems to work.
[1]http://hprange.github.com/wounit/usage.html
Cheers,
Henrique
> 18 апреля 2012 г. 11:53 пользователь Ron X <[email protected]> написал:
> hi everybody
>
> @Spy - not find in classpath
>
> <dependency>
> <groupId>com.wounit</groupId>
> <artifactId>wounit</artifactId>
> <version>1.3-SNAPSHOT</version>
> </dependency>
>
> why?
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/hprange%40gmail.com
>
> This email sent to [email protected]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]