@Test public void getParameterSummary() throws Exception { when(elements.getDocComment(executableElement)) .thenReturn( "\n" + " Bla bla bla\n" + " \n" + " @param name the name\n" + " @param content the content"); JavaDocUtils javaDocUtils = new JavaDocUtils(elements); assertEquals("the content", javaDocUtils.getParameterSummary("content", executableElement)); }
@Test public void getParameterSummaryParameterWithEmptyComment() throws Exception { when(elements.getDocComment(executableElement)) .thenReturn( "\n" + " Bla bla bla\n" + " \n" + " @param name the name\n" + " @param content"); JavaDocUtils javaDocUtils = new JavaDocUtils(elements); assertTrue(StringUtils.isBlank(javaDocUtils.getParameterSummary("content", executableElement))); }
@Test public void getTagContentSingleLineSampleTag() throws Exception { when(elements.getDocComment(executableElement)) .thenReturn( "\n" + " Updates the given map of customer address attributes, for the given customer address\n" + " <p/>\n" + " {@sample.xml ../../../doc/magento-connector.xml.sample magento:updateCustomerAddress}\n" + " \n" + " @param addressId the customer address to update\n" + " @param attributes the address attributes to update"); JavaDocUtils javaDocUtils = new JavaDocUtils(elements); String sample = javaDocUtils.getTagContent("sample.xml", executableElement); assertEquals("../../../doc/magento-connector.xml.sample magento:updateCustomerAddress", sample); }
@Test public void getParameterSummaryStartingAtNextLine() throws Exception { when(elements.getDocComment(executableElement)) .thenReturn( "\n" + " Authorize a payment\n" + " \n" + " {@sample.xml ../../../doc/mule-module-paypal.xml.sample paypal:authorize}\n" + " @param transactionId\n" + " The value of the order's transaction identification number"); JavaDocUtils javaDocUtils = new JavaDocUtils(elements); assertEquals( "The value of the order's transaction identification number", javaDocUtils.getParameterSummary("transactionId", executableElement)); }