001    // Copyright May 31, 2006 The Apache Software Foundation
002    //
003    // Licensed under the Apache License, Version 2.0 (the "License");
004    // you may not use this file except in compliance with the License.
005    // You may obtain a copy of the License at
006    //
007    //     http://www.apache.org/licenses/LICENSE-2.0
008    //
009    // Unless required by applicable law or agreed to in writing, software
010    // distributed under the License is distributed on an "AS IS" BASIS,
011    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012    // See the License for the specific language governing permissions and
013    // limitations under the License.
014    package org.apache.tapestry.data;
015    
016    import static org.easymock.EasyMock.expect;
017    
018    import org.apache.tapestry.BaseComponentTestCase;
019    import org.apache.tapestry.services.DataSqueezer;
020    import org.testng.annotations.Test;
021    
022    
023    /**
024     * 
025     * @author jcarman
026     */
027    @Test
028    public class TestNullDataSqueezerFilter extends BaseComponentTestCase
029    {
030        public void testSqueezeNull()
031        {
032            final NullDataSqueezerFilter filter = new NullDataSqueezerFilter();
033            
034            assertNull( filter.unsqueeze( filter.squeeze(( Object )null,null), null ) );
035        }
036        
037        public void testSqueezeNonNull()
038        {
039            final NullDataSqueezerFilter filter = new NullDataSqueezerFilter();
040            DataSqueezer mockSqueezer = newMock(DataSqueezer.class);
041            
042            expect(mockSqueezer.squeeze("Hello")).andReturn("World");
043            
044            replay();
045            
046            assertEquals("World", filter.squeeze("Hello", mockSqueezer));
047            
048            verify();
049        }
050    }