示例#1
0
 @Before
 public void setUp() {
   super.setUp();
   task = createTask(TestCopyTask.class);
   task.action = context.mock(CopyActionImpl.class);
   task.defaultSource = context.mock(FileCollection.class);
 }
示例#2
0
  @Test
  public void copySpecMethodsDelegateToMainSpecOfCopyAction() {
    context.checking(
        new Expectations() {
          {
            one(task.action).include("include");
            one(task.action).from("source");
          }
        });

    assertThat(task.include("include"), sameInstance((AbstractCopyTask) task));
    assertThat(task.from("source"), sameInstance((AbstractCopyTask) task));
  }
示例#3
0
 @Test
 public void usesDefaultSourceWhenNoSourceHasBeenSpecified() {
   context.checking(
       new Expectations() {
         {
           one(task.action).hasSource();
           will(returnValue(false));
         }
       });
   assertThat(task.getSource(), sameInstance(task.defaultSource));
 }
示例#4
0
 @Test
 public void doesNotUseDefaultSourceWhenSourceHasBeenSpecifiedOnSpec() {
   final FileTree source = context.mock(FileTree.class, "source");
   context.checking(
       new Expectations() {
         {
           one(task.action).hasSource();
           will(returnValue(true));
           one(task.action).getAllSource();
           will(returnValue(source));
         }
       });
   assertThat(task.getSource(), sameInstance((FileCollection) source));
 }