### Question:
TransMetaJsonDeserializer extends StdDeserializer<TransMeta> { protected void deserializeHops( TransMeta transMeta, JsonNode root, ObjectMapper mapper ) { ArrayNode hopsArray = (ArrayNode) root.get( TransMetaJsonSerializer.JSON_PROPERTY_HOPS ); for ( int i = 0; i < hopsArray.size(); i++ ) { JsonNode hopNode = hopsArray.get( i ); try { HopInfo hop = mapper.readValue( hopNode.toString(), HopInfo.class ); if ( hop != null ) { TransHopMeta hopMeta = new TransHopMeta(); hopMeta.setFromStep( transMeta.findStep( hop.getFromStepName() ) ); hopMeta.setToStep( transMeta.findStep( hop.getToStepName() ) ); hopMeta.setEnabled( hop.isEnabled() ); transMeta.addTransHop( hopMeta ); } } catch ( IOException e ) { LOGGER.warn( Messages.getString( "WARNING.Deserialization.Trans.Hops" ), e ); } } } TransMetaJsonDeserializer( Class<?> aClass );  TransMetaJsonDeserializer( Class<?> aClass, Repository repository ); Repository getRepository(); void setRepository( Repository repository ); @Override TransMeta deserialize( JsonParser parser, DeserializationContext context );  }### Answer:
@Test public void testDeserializeHops() throws Exception { transMeta = spy( new TransMeta() ); when( transMeta.findStep( "from" ) ).thenReturn( fromStep ); when( transMeta.findStep( "to" ) ).thenReturn( toStep ); when( mapper.readValue( "to be mocked", HopInfo.class ) ).thenReturn( hop0 ); when( root_hopsArray_hop0.toString() ).thenReturn( "to be mocked" ); when( hop0.isEnabled() ).thenReturn( true ); when( hop0.getFromStepName() ).thenReturn( "from" ); when( hop0.getToStepName() ).thenReturn( "to" ); deserializer.deserializeHops( transMeta, root, mapper ); assertEquals( root_hopsArray.size(), transMeta.nrTransHops() ); }