JSONDDMStorageAdapter implements DDMStorageAdapter { protected DDMStorageAdapterSaveResponse update( DDMStorageAdapterSaveRequest ddmStorageAdapterSaveRequest) throws StorageException { try { DDMContent ddmContent = ddmContentLocalService.getContent( ddmStorageAdapterSaveRequest.getPrimaryKey()); ddmContent.setModifiedDate(new Date()); ddmContent.setData( serialize(ddmStorageAdapterSaveRequest.getDDMFormValues())); ddmContentLocalService.updateContent( ddmContent.getPrimaryKey(), ddmContent.getName(), ddmContent.getDescription(), ddmContent.getData(), new ServiceContext()); DDMStorageAdapterSaveResponse.Builder builder = DDMStorageAdapterSaveResponse.Builder.newBuilder( ddmContent.getPrimaryKey()); return builder.build(); } catch (Exception exception) { throw new StorageException(exception); } }  @Override DDMStorageAdapterDeleteResponse delete(
			DDMStorageAdapterDeleteRequest ddmStorageAdapterDeleteRequest); @Override DDMStorageAdapterGetResponse get(
			DDMStorageAdapterGetRequest ddmStorageAdapterGetRequest); @Override DDMStorageAdapterSaveResponse save(
			DDMStorageAdapterSaveRequest ddmStorageAdapterSaveRequest);  }
@Test public void testUpdate() throws Exception { DDMContent ddmContent = mock(DDMContent.class); when( _ddmContentLocalService.getContent(1) ).thenReturn( ddmContent ); when( ddmContent.getPrimaryKey() ).thenReturn( 1L ); DDMFormValues ddmFormValues = mock(DDMFormValues.class); DDMFormValuesSerializerSerializeResponse ddmFormValuesSerializerSerializeResponse = DDMFormValuesSerializerSerializeResponse.Builder.newBuilder( "{}" ).build(); when( _ddmFormValuesSerializer.serialize( Mockito.any(DDMFormValuesSerializerSerializeRequest.class)) ).thenReturn( ddmFormValuesSerializerSerializeResponse ); DDMStorageAdapterSaveRequest.Builder builder = DDMStorageAdapterSaveRequest.Builder.newBuilder( 1, 1, ddmFormValues); DDMStorageAdapterSaveRequest ddmStorageAdapterSaveRequest = builder.withPrimaryKey( 1 ).build(); DDMStorageAdapterSaveResponse ddmStorageAdapterSaveResponse = _jsonDDMStorageAdapter.save(ddmStorageAdapterSaveRequest); Assert.assertEquals(1L, ddmStorageAdapterSaveResponse.getPrimaryKey()); Mockito.verify( ddmContent, Mockito.times(1) ).setModifiedDate( Matchers.any(Date.class) ); Mockito.verify( ddmContent, Mockito.times(1) ).setData( Matchers.anyString() ); Mockito.verify( _ddmFormValuesSerializer, Mockito.times(1) ).serialize( Mockito.any(DDMFormValuesSerializerSerializeRequest.class) ); Mockito.verify( _ddmContentLocalService, Mockito.times(1) ).updateContent( Matchers.anyLong(), Matchers.anyString(), Matchers.anyString(), Matchers.anyString(), Matchers.any(ServiceContext.class) ); }