ResourceModel { private boolean hasSlot(List<Slot> slots, String bundleId) { if (slots == null) { return false; } for (Slot slot : slots) { if (slot.getId().equalsIgnoreCase(bundleId)) { return true; } } return false; } ResourceModel();  ResourceModel(String requestUri); void enableCollectResources(String resType, boolean enabled); Set<String> getCollectedResource(String resType); String getRequestUri(); Slot getSlot(String slotId, String type); Map<String, List<IResource>> getSlotAfterResources(String slotId, String type); Map<String, List<IResource>> getSlotBeforeResources(String slotId, String type); List<IResource> getSlotResources(String slotId, String type); List<Slot> getSlots(String type); boolean isResourceRenderable(IResource resource); boolean isResourceRendered(IResource sample); void processModel(); boolean registerResource(IResource resource, String slotId); boolean registerSlot(String slotId, String type); void reset(); void setRenderedResource(IResource resource); void setRenderedResource(String urn); void setRequestUri(String requestUri); @Override String toString();  }
@Test public void testHasSlot() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { Class<ResourceModel> clazz = ResourceModel.class; Method method = clazz.getDeclaredMethod("hasSlot", List.class, String.class); method.setAccessible(true); ResourceModel model = ResourceRuntimeContext.ctx().getModel(); Object flag = method.invoke(model, null, "testBundle"); if(flag instanceof Boolean) { boolean hasSlot = (Boolean)flag; Assert.assertFalse(hasSlot); } List<Slot> slots = new ArrayList<Slot>(); Slot slot = new Slot("js-slot", "js"); slots.add(slot); flag = method.invoke(model, slots, "testBundle"); if(flag instanceof Boolean) { boolean hasSlot = (Boolean)flag; Assert.assertFalse(hasSlot); } flag = method.invoke(model, slots, "js-slot"); if(flag instanceof Boolean) { boolean hasSlot = (Boolean)flag; Assert.assertTrue(hasSlot); } }