1   package test.atlassian.core.ofbiz;
2   
3   import com.atlassian.core.ofbiz.test.AbstractOFBizTestCase;
4   import com.atlassian.core.ofbiz.test.UtilsForTests;
5   import com.atlassian.core.ofbiz.util.OFBizPropertyUtils;
6   
7   import org.ofbiz.core.entity.GenericValue;
8   import org.ofbiz.core.util.UtilMisc;
9   
10  import com.opensymphony.module.propertyset.PropertySet;
11  
12  public class TestOFBizPropertyUtils extends AbstractOFBizTestCase
13  {
14      public void testCreateRemovePropertySet()
15      {
16          // first create it and then check we can get/set a string
17          final GenericValue entity = UtilsForTests.getTestEntity("TestEntity", UtilMisc.toMap("id", new Long(1)));
18          PropertySet ps = OFBizPropertyUtils.getPropertySet(entity);
19          ps.setString("foo", "bar");
20          assertEquals("bar", ps.getString("foo"));
21  
22          // remove
23          OFBizPropertyUtils.removePropertySet(entity);
24  
25          // now make sure it's blank
26          ps = OFBizPropertyUtils.getPropertySet(entity);
27          assertNull(ps.getString("foo"));
28      }
29  }