SmilResponseImpl implements SmilResponse { @Override public int getEntitiesCount() { if (entities == null) { return 0; } else { return entities.length; } } private  SmilResponseImpl();  SmilResponseImpl(Smil smil);  SmilResponseImpl(Smil smil, SmilObject entity);  SmilResponseImpl(Smil smil, SmilObject[] entities); @XmlElement(type = SmilImpl.class, required = true) @Override Smil getSmil(); @Override int getEntitiesCount(); @Override SmilObject getEntity(); @Override SmilObject[] getEntities(); @Override String toXml(); static SmilResponse fromXml(String smilResponseXml);  }
@Test public void testGetEntitiesCount() { Smil smil = new SmilImpl(); SmilResponse response = new SmilResponseImpl(smil); assertSame(0, response.getEntitiesCount()); response = new SmilResponseImpl(smil, smil.getBody()); assertSame(1, response.getEntitiesCount()); response = new SmilResponseImpl(smil, new SmilObject[]{smil.getHead(), smil.getBody()}); assertSame(2, response.getEntitiesCount()); }