@Test public void whenFindingMemberThatDoNotExsitsShouldReturnNull() { IResource expectedMember = Mockito.mock(IResource.class); when(workspace.newResource(any(IPath.class))).thenReturn(expectedMember); when(workspace.newResource(any(IPath.class))).thenReturn(null); IResource actualMember = container.findMember(path); assertNull(actualMember); actualMember = container.findMember(path); assertNull(actualMember); }
@Test public void findMemberByString() { IResource expectedMember = Mockito.mock(IResource.class); when(workspace.newResource(any(IPath.class))).thenReturn(expectedMember); when(expectedMember.exists()).thenReturn(true); IResource actualMember = container.findMember("test"); assertNotNull(actualMember); assertEquals(expectedMember, actualMember); }