### Question:
AwesomeDynamicListModelUtilsImpl implements AwesomeDynamicListModelUtils { public final void proxyBelongsToFields(final Entity entity) { DataDefinition dataDefinition = entity.getDataDefinition(); for (Entry<String, FieldDefinition> fieldDefinitionEntry : dataDefinition.getFields().entrySet()) { if (fieldDefinitionEntry.getValue().getType() instanceof BelongsToType) { proxyBelongsToField(fieldDefinitionEntry.getValue(), entity); } } }  final void proxyBelongsToFields(final Entity entity);  }### Answer:
@Test public final void shouldSetProxyEntityInPlaceOfLong() throws Exception { when(entity.getField(BELONGS_TO_FIELD_NAME)).thenReturn(1L); ArgumentCaptor<Entity> entityCaptor = ArgumentCaptor.forClass(Entity.class); awesomeDynamicListModelUtils.proxyBelongsToFields(entity); verify(entity, Mockito.times(1)).setField(Mockito.eq(BELONGS_TO_FIELD_NAME), entityCaptor.capture()); assertProxy(entityCaptor.getValue()); }
@Test public final void shouldSetProxyEntityInPlaceOfInteger() throws Exception { when(entity.getField(BELONGS_TO_FIELD_NAME)).thenReturn(1); ArgumentCaptor<Entity> entityCaptor = ArgumentCaptor.forClass(Entity.class); awesomeDynamicListModelUtils.proxyBelongsToFields(entity); verify(entity, Mockito.times(1)).setField(Mockito.eq(BELONGS_TO_FIELD_NAME), entityCaptor.capture()); assertProxy(entityCaptor.getValue()); }
@Test public final void shouldSetProxyEntityInPlaceOfString() throws Exception { when(entity.getField(BELONGS_TO_FIELD_NAME)).thenReturn("1"); ArgumentCaptor<Entity> entityCaptor = ArgumentCaptor.forClass(Entity.class); awesomeDynamicListModelUtils.proxyBelongsToFields(entity); verify(entity, Mockito.times(1)).setField(Mockito.eq(BELONGS_TO_FIELD_NAME), entityCaptor.capture()); assertProxy(entityCaptor.getValue()); }
@Test public final void shouldSetProxyEntityInPlaceOfEntity() throws Exception { Entity belongsToEntity = mock(Entity.class); when(belongsToEntity.getId()).thenReturn(1L); when(entity.getField(BELONGS_TO_FIELD_NAME)).thenReturn(belongsToEntity); ArgumentCaptor<Entity> entityCaptor = ArgumentCaptor.forClass(Entity.class); awesomeDynamicListModelUtils.proxyBelongsToFields(entity); verify(entity, Mockito.times(1)).setField(Mockito.eq(BELONGS_TO_FIELD_NAME), entityCaptor.capture()); assertProxy(entityCaptor.getValue()); }
@Test public final void shouldSetProxyEntityToNull() throws Exception { awesomeDynamicListModelUtils.proxyBelongsToFields(entity); verify(entity, Mockito.never()).setField(Mockito.eq(BELONGS_TO_FIELD_NAME), Mockito.any(Entity.class)); }