### Question:
GenericListAdapterFactory implements AdapterFactory { private GenericList adaptToGenericList(@CheckForNull Object obj) { if (obj == null) { return null; } final Page page = (Page) obj; if (page.getContentResource() != null && page.getContentResource().isResourceType(GenericListImpl.RT_GENERIC_LIST) && page.getContentResource().getChild("list") != null) { return new GenericListImpl(page.getContentResource().getChild("list")); } return null; }  @SuppressWarnings("unchecked") @Override final AdapterType getAdapter(@CheckForNull Object obj, @Nonnull Class<AdapterType> clazz);  }### Answer:
@Test public void test_that_adapting_page_with_wrong_resourceType_returns_null() { Page wrongPage = mock(Page.class); Resource wrongContentResource = mock(Resource.class); when(wrongPage.getContentResource()).thenReturn(wrongContentResource); when(wrongContentResource.isResourceType(GenericListImpl.RT_GENERIC_LIST)).thenReturn(false); GenericList section = adaptToGenericList(wrongPage); assertNull(section); }
@Test public void test_that_adapting_page_with_null_template_returns_null() { Page wrongPage = mock(Page.class); GenericList section = adaptToGenericList(wrongPage); assertNull(section); }