### Question:
AbstractNcGetLegend extends AbstractGetLegend implements NcGetLegendRequest { @Override protected void prepareParameters() { super.prepareParameters(); if (opacity != null) requestParameters.put("OPACITY", String.valueOf(opacity)); if (numColorBands != null) requestParameters.put("NUMCOLORBANDS", String.valueOf(numColorBands)); if (logScale != null) requestParameters.put("LOGSCALE", String.valueOf(logScale)); if (palette != null) requestParameters.put("PALETTE", palette); } protected  AbstractNcGetLegend(final String serverURL, final String version, final ClientSecurity security); @Override Integer getOpacity(); @Override void setOpacity(final Integer opacity); @Override Integer getNumColorBands(); @Override void setNumColorBands(final Integer numColorBands); @Override Boolean isLogScale(); @Override void setLogScale(final Boolean logScale); @Override String getPalette(); @Override void setPalette(final String palette);  }### Answer:
@Test public void testPrepareParameters() { final NcGetLegendImpl legend = new NcGetLegendImpl("http: legend.setLayer("test"); legend.setFormat("image/png"); legend.setOpacity(60); legend.setLogScale(true); legend.setPalette("test"); legend.setNumColorBands(125); legend.dimensions().put("COLORSCALERANGE","20,30"); final URL url; try { url = legend.getURL(); } catch (MalformedURLException ex) { fail(ex.getLocalizedMessage()); return; } final String sUrl = url.toString(); assertTrue("was:" + sUrl, sUrl.contains("OPACITY=60")); assertTrue("was:" + sUrl, sUrl.contains("LOGSCALE=true")); assertTrue("was:" + sUrl, sUrl.contains("PALETTE=test")); assertTrue("was:" + sUrl, sUrl.contains("NUMCOLORBANDS=125")); assertTrue("was:" + sUrl, sUrl.contains("COLORSCALERANGE=20%2C30")); }