Index: topia2/src/test/org/codelutin/topia/framework/EntityStateTest.java diff -u /dev/null topia2/src/test/org/codelutin/topia/framework/EntityStateTest.java:1.1 --- /dev/null Wed Nov 22 20:21:02 2006 +++ topia2/src/test/org/codelutin/topia/framework/EntityStateTest.java Wed Nov 22 20:20:57 2006 @@ -0,0 +1,80 @@ +/* *##% + * Copyright (C) 2006 + * Code Lutin, Cédric Pineau, Benjamin Poussin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * EntityStateTest.java + * + * Created: 22 nov. 06 12:15:11 + * + * @author poussin + * @version $Revision: 1.1 $ + * + * Last update: $Date: 2006/11/22 20:20:57 $ + * by : $Author: bpoussin $ + */ + +package org.codelutin.topia.framework; + +import junit.framework.TestCase; + + +/** + * @author poussin + * + */ + +public class EntityStateTest extends TestCase { + + public void testState() throws Exception { + EntityState state = new EntityState(); + assertTrue(state.isLoad()); + assertFalse(state.isRead()); + assertFalse(state.isCreate()); + assertFalse(state.isUpdate()); + assertFalse(state.isDelete()); + + state.addRead(); + state.addCreate(); + assertTrue(state.isRead()); + assertTrue(state.isCreate()); + assertFalse(state.isUpdate()); + assertFalse(state.isDelete()); + + state.addUpdate(); + assertTrue(state.isRead()); + assertTrue(state.isCreate()); + assertTrue(state.isUpdate()); + assertFalse(state.isDelete()); + + state.addDelete(); + assertTrue(state.isRead()); + assertTrue(state.isCreate()); + assertTrue(state.isUpdate()); + assertTrue(state.isDelete()); + + state = new EntityState(); + state.addDelete(); + assertFalse(state.isRead()); + assertFalse(state.isCreate()); + assertFalse(state.isUpdate()); + assertTrue(state.isDelete()); + } +} + +