@Test public void testIncrementCounter() throws Exception { int counter = 10; PortletPreferences preferences = new MockPortletPreferences(); preferences.setValue("counter", String.valueOf(counter)); MockPortletRequest request = new MockPortletRequest(); request.setPreferences(preferences); PortalPropertiesPrettierPortlet portlet = new PortalPropertiesPrettierPortlet(); portlet.incrementCounter(request); String actual = preferences.getValue("counter", "0"); Assert.assertEquals(counter + 1, GetterUtil.getInteger(actual)); }
protected void incrementCounter(PortletRequest request) throws IOException, PortletException { PortletPreferences preferences = request.getPreferences(); int count = GetterUtil.getInteger(preferences.getValue("counter", "0")); count++; preferences.setValue("counter", String.valueOf(count)); preferences.store(); }
PortalPropertiesPrettierPortlet extends MVCPortlet { protected void incrementCounter(PortletRequest request) throws IOException, PortletException { PortletPreferences preferences = request.getPreferences(); int count = GetterUtil.getInteger(preferences.getValue("counter", "0")); count++; preferences.setValue("counter", String.valueOf(count)); preferences.store(); } }
PortalPropertiesPrettierPortlet extends MVCPortlet { protected void incrementCounter(PortletRequest request) throws IOException, PortletException { PortletPreferences preferences = request.getPreferences(); int count = GetterUtil.getInteger(preferences.getValue("counter", "0")); count++; preferences.setValue("counter", String.valueOf(count)); preferences.store(); }  }
PortalPropertiesPrettierPortlet extends MVCPortlet { protected void incrementCounter(PortletRequest request) throws IOException, PortletException { PortletPreferences preferences = request.getPreferences(); int count = GetterUtil.getInteger(preferences.getValue("counter", "0")); count++; preferences.setValue("counter", String.valueOf(count)); preferences.store(); }  void prettify(ActionRequest request, ActionResponse response); void serveResource(ResourceRequest request, ResourceResponse response); @Reference(unbind = "-") void setPortalPropertiesPrettier(PortalPropertiesPrettier prettier); }
PortalPropertiesPrettierPortlet extends MVCPortlet { protected void incrementCounter(PortletRequest request) throws IOException, PortletException { PortletPreferences preferences = request.getPreferences(); int count = GetterUtil.getInteger(preferences.getValue("counter", "0")); count++; preferences.setValue("counter", String.valueOf(count)); preferences.store(); }  void prettify(ActionRequest request, ActionResponse response); void serveResource(ResourceRequest request, ResourceResponse response); @Reference(unbind = "-") void setPortalPropertiesPrettier(PortalPropertiesPrettier prettier);  }