001: /********************************************************************************
002: * CruiseControl, a Continuous Integration Toolkit
003: * Copyright (c) 2005, ThoughtWorks, Inc.
004: * 200 E. Randolph, 25th Floor
005: * Chicago, IL 60601 USA
006: * All rights reserved.
007: *
008: * Redistribution and use in source and binary forms, with or without
009: * modification, are permitted provided that the following conditions
010: * are met:
011: *
012: * + Redistributions of source code must retain the above copyright
013: * notice, this list of conditions and the following disclaimer.
014: *
015: * + Redistributions in binary form must reproduce the above
016: * copyright notice, this list of conditions and the following
017: * disclaimer in the documentation and/or other materials provided
018: * with the distribution.
019: *
020: * + Neither the name of ThoughtWorks, Inc., CruiseControl, nor the
021: * names of its contributors may be used to endorse or promote
022: * products derived from this software without specific prior
023: * written permission.
024: *
025: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
026: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
027: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
028: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
029: * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
030: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
031: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
032: * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
033: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
034: * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
035: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
036: ********************************************************************************/package net.sourceforge.cruisecontrol.sourcecontrols;
037:
038: import java.util.Date;
039: import java.util.List;
040: import java.util.Map;
041:
042: import junit.framework.TestCase;
043: import net.sourceforge.cruisecontrol.CruiseControlException;
044:
045: public class ForceOnlyTest extends TestCase {
046:
047: public void testGettingModifications() {
048: ForceOnly forceOnly = new ForceOnly();
049:
050: List mods = forceOnly.getModifications(null, null);
051: assertNotNull(mods);
052: assertEquals(
053: "ForceOnly source control should never return any mods.",
054: 0, mods.size());
055:
056: mods = forceOnly.getModifications(new Date(), new Date());
057: assertNotNull(mods);
058: assertEquals(
059: "ForceOnly source control should never return any mods.",
060: 0, mods.size());
061:
062: mods = forceOnly.getModifications(new Date(0), null);
063: assertNotNull(mods);
064: assertEquals(
065: "ForceOnly source control should never return any mods.",
066: 0, mods.size());
067:
068: mods = forceOnly.getModifications(null, new Date(0));
069: assertNotNull(mods);
070: assertEquals(
071: "ForceOnly source control should never return any mods.",
072: 0, mods.size());
073:
074: mods = forceOnly.getModifications(new Date(0), new Date());
075: assertNotNull(mods);
076: assertEquals(
077: "ForceOnly source control should never return any mods.",
078: 0, mods.size());
079: }
080:
081: public void testSettingProperties() {
082: ForceOnly forceOnly = new ForceOnly();
083:
084: Map props = forceOnly.getProperties();
085: assertNotNull(props);
086: assertEquals("Expected the properties to be empty", 0, props
087: .size());
088: }
089:
090: public void testValidate() {
091: ForceOnly forceOnly = new ForceOnly();
092:
093: //validating should never throw an exception.
094: try {
095: forceOnly.validate();
096: } catch (CruiseControlException e) {
097: fail("validate should never throw an exception");
098: }
099: }
100: }
|