use of org.jmock.Expectations in project gradle by gradle.
the class DefaultDomainObjectCollectionTest method callsRemoveActionWhenObjectRemoved.
@Test
public void callsRemoveActionWhenObjectRemoved() {
@SuppressWarnings("unchecked") final Action<CharSequence> action = context.mock(Action.class);
final String original = "a";
context.checking(new Expectations() {
{
oneOf(action).execute(with(sameInstance(original)));
}
});
container.whenObjectRemoved(action);
container.add(original);
assertTrue(container.remove(original));
}
use of org.jmock.Expectations in project gradle by gradle.
the class DefaultDomainObjectCollectionTest method allCallsActionForEachNewObject.
@Test
public void allCallsActionForEachNewObject() {
@SuppressWarnings("unchecked") final Action<CharSequence> action = context.mock(Action.class);
context.checking(new Expectations() {
{
oneOf(action).execute("a");
}
});
container.all(action);
container.add("a");
}
use of org.jmock.Expectations in project gradle by gradle.
the class DefaultDomainObjectCollectionTest method callsVetoActionOnceBeforeCollectionIsAdded.
@Test
public void callsVetoActionOnceBeforeCollectionIsAdded() {
final Action<Void> action = Cast.uncheckedCast(context.mock(Action.class));
container.beforeChange(action);
context.checking(new Expectations() {
{
oneOf(action).execute(null);
}
});
container.addAll(toList("a", "b"));
}
use of org.jmock.Expectations in project gradle by gradle.
the class BasePomFilterContainerTest method setUp.
@Before
public void setUp() {
pomFilterMock = context.mock(PomFilter.class);
pomMock = context.mock(MavenPom.class);
publishFilterMock = context.mock(PublishFilter.class);
context.checking(new Expectations() {
{
allowing(mavenPomFactoryMock).create();
will(returnValue(pomMock));
}
});
pomFilterContainer = createPomFilterContainer();
pomFilterContainer.setDefaultPomFilter(pomFilterMock);
}
use of org.jmock.Expectations in project gradle by gradle.
the class BasePomFilterContainerTest method setPom.
@Test
public void setPom() {
context.checking(new Expectations() {
{
allowing(pomFilterMock).setPomTemplate(pomMock);
}
});
pomFilterContainer.setPom(pomMock);
}
Aggregations