this.checkPoint();
// Add some preferences
portDef2 = this.jpaPortletDefinitionDao.getPortletDefinition(portDef2.getPortletDefinitionId());
final IPortletPreferences prefs2 = portDef2.getPortletPreferences();
final List<IPortletPreference> prefsList2 = prefs2.getPortletPreferences();
prefsList2.add(new PortletPreferenceImpl("prefName1", false, "val1", "val2"));
prefsList2.add(new PortletPreferenceImpl("prefName2", true, "val3", "val4"));
this.jpaPortletDefinitionDao.updatePortletDefinition(portDef2);
this.checkPoint();
// Check prefs, remove one and another
final IPortletDefinition portDef3 = this.jpaPortletDefinitionDao.getPortletDefinition(portDef2.getPortletDefinitionId());
final IPortletPreferences prefs3 = portDef3.getPortletPreferences();
final List<IPortletPreference> prefsList3 = prefs3.getPortletPreferences();
final List<IPortletPreference> expectedPrefsList3 = new ArrayList<IPortletPreference>();
expectedPrefsList3.add(new PortletPreferenceImpl("prefName1", false, "val1", "val2"));
expectedPrefsList3.add(new PortletPreferenceImpl("prefName2", true, "val3", "val4"));
assertEquals(expectedPrefsList3, prefsList3);
prefsList3.remove(1);
prefsList3.add(new PortletPreferenceImpl("prefName3", false, "val5", "val6"));
this.jpaPortletDefinitionDao.updatePortletDefinition(portDef3);
this.checkPoint();
// Check prefs
final IPortletDefinition portDef4 = this.jpaPortletDefinitionDao.getPortletDefinition(portDef3.getPortletDefinitionId());
final IPortletPreferences prefs4 = portDef4.getPortletPreferences();
final List<IPortletPreference> prefsList4 = prefs4.getPortletPreferences();
final List<IPortletPreference> expectedPrefsList4 = new ArrayList<IPortletPreference>();
expectedPrefsList4.add(new PortletPreferenceImpl("prefName1", false, "val1", "val2"));
expectedPrefsList4.add(new PortletPreferenceImpl("prefName3", false, "val5", "val6"));