title: ClassCastException: com.fasterxml.jackson.databind.node.MissingNode cannot be cast to com.fasterxml.jackson.databind.node.Arraynode
body: <p>I have a reader that maps data from instagram to my system. When performing Junit Test I ran into ClassCastException. My test class has the following code:</p>
  
  <pre><code>public class InstagramToJsonMapperTest extends AbstractMapperTest {
  
  private InstagramMapper instagramMapper;
  private boolean printResult = true;
  
  @Before
      public void setup() {
          super.setup();
          instagramMapper = new InstagramMapper(128);
      }
  
      private void compareJson(String unmapped, String mapped) throws Exception {
          JsonNode unmappedJson = loadJson(unmapped);
          JsonNode mappedJson = loadJson(mapped);
          Message&lt;JsonNode&gt; msg = MessageBuilder.withPayload(unmappedJson).build();
          Message&lt;JsonNode&gt; resultMsg = instagramMapper.map(msg);
          JsonNode result = resultMsg.getPayload();
          if(printResult) {
              System.out.println("processed: " + result);
              System.out.println("expected: " + mappedJson.toString());
          }
          Assert.assertTrue(JacksonUtils.equals(result, mappedJson));
      }
  
      @Test
      public void testPhoto() throws Exception {
          compareJson("/mapping/test.json", "/mapping/test_mapped.json");
      }
  
  }
  </code></pre>
  
  <p>The error is because of this line in my mapper:</p>
  
  <pre><code>String[] branches = JacksonUtils.toArray((ArrayNode) extractor.extract("contentBranch"));
          if(branches.length == 1) {
              abc.put("contentBranch", branches[0]);
          } else {
              abc.set("contentBranch", JacksonUtils.arrayToArrayNode(branches));
          }
  </code></pre>
  
  <p>My problem is, I dont know what to change. Should I change my mapper code or the code in my test file. The error is: </p>
  
  <pre><code>ClassCastException: com.fasterxml.jackson.databind.node.MissingNode cannot be 
      cast to com.fasterxml.jackson.databind.node.Arraynode
  </code></pre>