@Test public void testConvertOtherModuleName() { final Pom mockPom = mock(Pom.class); final String moduleName = "foo" + File.separator + "bar"; when(mockProjectOperations.getPomFromModuleName(moduleName)).thenReturn(mockPom); assertEquals(mockPom, converter.convertFromText(moduleName, null, null)); }
private void assertCompletions( final String optionContext, final String focusedModuleName, final Collection<String> moduleNames, final String... expectedCompletions) { // Set up when(mockProjectOperations.getFocusedModuleName()).thenReturn(focusedModuleName); when(mockProjectOperations.getModuleNames()).thenReturn(moduleNames); final List<Completion> completions = new ArrayList<Completion>(); // Invoke final boolean allValuesComplete = converter.getAllPossibleValues(completions, null, null, optionContext, null); // Check assertTrue(allValuesComplete); assertEquals( "Expected " + Arrays.toString(expectedCompletions) + " but was " + completions, expectedCompletions.length, completions.size()); for (int i = 0; i < expectedCompletions.length; i++) { assertEquals(expectedCompletions[i], completions.get(i).getValue()); } }
@Test public void testConvertRootModuleSymbol() { final Pom mockRootPom = mock(Pom.class); when(mockProjectOperations.getPomFromModuleName("")).thenReturn(mockRootPom); assertEquals(mockRootPom, converter.convertFromText(ROOT_MODULE_SYMBOL, null, null)); }