1   /*
2    * $Id: BatchConstraintTestCase.java 7963 2007-08-21 08:53:15Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.transaction;
12  
13  import org.mule.tck.AbstractMuleTestCase;
14  import org.mule.transaction.constraints.BatchConstraint;
15  import org.mule.transaction.constraints.ConstraintFilter;
16  import org.mule.umo.UMOEvent;
17  
18  import com.mockobjects.dynamic.Mock;
19  
20  public class BatchConstraintTestCase extends AbstractMuleTestCase
21  {
22  
23      public void testConstraintFilter() throws Exception
24      {
25          UMOEvent testEvent = (UMOEvent)new Mock(UMOEvent.class).proxy();
26          BatchConstraint filter = new BatchConstraint();
27          filter.setBatchSize(3);
28          assertEquals(3, filter.getBatchSize());
29          assertTrue(!filter.accept(testEvent));
30  
31          ConstraintFilter clone = (ConstraintFilter)filter.clone();
32          assertNotNull(clone);
33          assertNotSame(filter, clone);
34  
35          assertTrue(!filter.accept(testEvent));
36          assertTrue(filter.accept(testEvent));
37      }
38  
39  }