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

at.spardat.xma.mdl.test.TransStringSetNTest 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: TransStringSetNTest.java 2089 2007-11-28 13:56:13Z s3460 $
package at.spardat.xma.mdl.test;

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

/**
 * 
 * @author YSD, 10.04.2003 11:41:51
 */
public class TransStringSetNTest extends TestCase {

    /**
     * Constructor for TransStringSetNTest.
     * @param name
     */
    public TransStringSetNTest(String name) {
        super(name);
    }
    
    public void testSzenario1 () throws Exception {
        TransStringSetN  s = new TransStringSetN ();
        assertTrue(!s.changed());
        s = fill2 (false);
        assertTrue(s.size() == 2);
        assertTrue(s.contains("s1"));
        assertTrue(s.contains("s2"));
        assertTrue(s.changed());
        s.rollback();
        assertTrue(s.size() == 0);
        s = fill2 (true);
        assertTrue(s.size() == 2);
        assertTrue(s.contains("s1"));
        assertTrue(s.contains("s2"));
        assertTrue(!s.changed());
        s.rollback();
        assertTrue(s.size() == 2);
        assertTrue(s.contains("s1"));
        assertTrue(s.contains("s2"));
        assertTrue(!s.changed());
        
        s.add("s3");
        assertTrue(s.changed());
        s.remove("s2");
        s.rollback();
        assertTrue(s.size() == 2);
        assertTrue(s.contains("s1"));
        assertTrue(s.contains("s2"));
        assertTrue(!s.changed());
        
        
    }
    
    private TransStringSetN fill2 (boolean committed) {
        TransStringSetN  s = new TransStringSetN ();
        s.add("s1");
        s.add("s2");
        if (committed) s.commit();  
        return s;      
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy