All Downloads are FREE. Search and download functionalities are using the official Maven repository.

at.spardat.xma.mdl.test.TransStringSet1Test Maven / Gradle / Ivy

The newest version!
/*******************************************************************************
 * Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH .
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     s IT Solutions AT Spardat GmbH - initial API and implementation
 *******************************************************************************/

// @(#) $Id: TransStringSet1Test.java 2089 2007-11-28 13:56:13Z s3460 $
package at.spardat.xma.mdl.test;

import at.spardat.xma.mdl.util.TransStringSet1;
import junit.framework.TestCase;

/**
 * 
 * @author YSD, 10.04.2003 11:04:52
 */
public class TransStringSet1Test extends TestCase {

    /**
     * Constructor for TransStringSet1Test.
     * @param name
     */
    public TransStringSet1Test(String name) {
        super(name);
    }
    
    public void testSzenario1 () throws Exception {
        TransStringSet1 s1 = new TransStringSet1 ();
        assertTrue (s1.getSome() == null);
        assertTrue (!s1.changed());
        s1.add("hx");
        assertTrue (s1.changed());
        s1.rollback();
        assertTrue (s1.getSome() == null);
        assertTrue (!s1.changed());
        s1.add("hy");
        assertTrue (s1.getSome().equals("hy"));
        s1.commit();
        assertTrue (!s1.changed());
        assertTrue (s1.getSome().equals("hy"));
        s1.rollback();
        assertTrue (s1.getSome().equals("hy"));
        s1.add("x");
        assertTrue (s1.getSome().equals("x"));
        s1.rollback();
        assertTrue (s1.getSome().equals("hy"));
        assertTrue (!s1.changed());
    }
    
    public void testChangeToOld () throws Exception {
        TransStringSet1 s1 = new TransStringSet1 ();
        s1.add("old");
        s1.commit();
        s1.add("new");
        assertTrue (s1.changed());
        s1.add("old");
        assertTrue (!s1.changed());        
    }
    
    public void testClear () throws Exception {
        TransStringSet1 s1 = new TransStringSet1 ();
        s1.add("old");
        s1.commit();
        s1.clear();
        assertTrue (s1.changed());
        s1.add("old");
        assertTrue (!s1.changed());
        s1.clear();
        assertTrue (s1.changed());
        s1.commit();
        assertTrue (s1.getSome() == null);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy