private void assertModuleFocusAllowed(final boolean expectedResult, final String... moduleNames) {
    // Set up
    when(mockPomManagementService.getModuleNames()).thenReturn(Arrays.asList(moduleNames));

    // Invoke and check
    assertEquals(expectedResult, projectOperations.isModuleFocusAllowed());
  }
  @Test
  public void testGetFocusedModuleWhenNoModulesExist() {
    // Set up
    when(mockPomManagementService.getFocusedModuleName()).thenReturn("");
    when(mockMetadataService.get(ProjectMetadata.getProjectIdentifier(""))).thenReturn(null);

    // Invoke and check
    assertNull(projectOperations.getFocusedModule());
  }
  @Test
  public void testGetFocusedModuleWhenChildModuleHasFocus() {
    // Set up
    when(mockPomManagementService.getFocusedModuleName()).thenReturn("child");
    final Pom mockChildPom = mock(Pom.class);
    final ProjectMetadata mockChildMetadata = mock(ProjectMetadata.class);
    when(mockChildMetadata.getPom()).thenReturn(mockChildPom);
    when(mockMetadataService.get(ProjectMetadata.getProjectIdentifier("child")))
        .thenReturn(mockChildMetadata);

    // Invoke and check
    assertEquals(mockChildPom, projectOperations.getFocusedModule());
  }