| 1 | /* |
| 2 | * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package net.sf.antcontrib.logic; |
| 17 | |
| 18 | import net.sf.antcontrib.BuildFileTestBase; |
| 19 | |
| 20 | /** |
| 21 | * Since AntCallBack is basically a copy and paste of antcall, the only testing |
| 22 | * done here is on the extra features provided by antcallback. It is assumed |
| 23 | * that changes to antcall will be propagated to antcallback and that antcall |
| 24 | * has it's own unit tests (which turns out to have been a bad assumption, |
| 25 | * I can't find any unit tests for antcall). |
| 26 | * |
| 27 | * @author danson |
| 28 | */ |
| 29 | public class AntCallBackTest extends BuildFileTestBase { |
| 30 | |
| 31 | /** |
| 32 | * Constructor for the AntCallBackTest object |
| 33 | * |
| 34 | * @param name Description of the Parameter |
| 35 | */ |
| 36 | public AntCallBackTest( String name ) { |
| 37 | super( name ); |
| 38 | } |
| 39 | |
| 40 | |
| 41 | /** The JUnit setup method */ |
| 42 | public void setUp() { |
| 43 | configureProject( "test/resources/logic/antcallbacktest.xml" ); |
| 44 | } |
| 45 | |
| 46 | |
| 47 | /** A unit test for JUnit */ |
| 48 | public void test1() { |
| 49 | expectPropertySet( "test1", "prop1", "prop1" ); |
| 50 | } |
| 51 | |
| 52 | |
| 53 | /** A unit test for JUnit */ |
| 54 | public void test2() { |
| 55 | expectPropertySet( "test2", "prop1", "prop1" ); |
| 56 | expectPropertySet( "test2", "prop2", "prop2" ); |
| 57 | expectPropertySet( "test2", "prop3", "prop3" ); |
| 58 | } |
| 59 | |
| 60 | |
| 61 | /** A unit test for JUnit */ |
| 62 | public void test3() { |
| 63 | expectPropertySet( "test3", "prop1", "prop1" ); |
| 64 | expectPropertySet( "test3", "prop2", "prop2" ); |
| 65 | expectPropertySet( "test3", "prop3", "prop3" ); |
| 66 | } |
| 67 | |
| 68 | |
| 69 | /** A unit test for JUnit */ |
| 70 | public void test4() { |
| 71 | expectPropertyUnset( "test4", "prop1" ); |
| 72 | expectPropertySet( "test4", "prop2", "prop2" ); |
| 73 | expectPropertySet( "test4", "prop3", "prop3" ); |
| 74 | } |
| 75 | |
| 76 | |
| 77 | /** A unit test for JUnit */ |
| 78 | public void test5() { |
| 79 | expectPropertySet( "test5", "prop1", "blah" ); |
| 80 | expectPropertySet( "test5", "prop2", "prop2" ); |
| 81 | expectPropertySet( "test5", "prop3", "prop3" ); |
| 82 | } |
| 83 | } |
| 84 |