### Question:
PolicyClientImpl implements PolicyClient { @Override public Config getConfigWithPolicyName(String policyName) { PolicyRestClient client = this.getPolicyRestClient(PolicyServiceType.GET_CONFIG); ConfigRequestParameters configReqParameters = new ConfigRequestParameters(); configReqParameters.setPolicyName(policyName); PolicyConfig[] policyConfigList = client.post(configReqParameters, PolicyConfig[].class); PolicyConfig policyConfig = null; if (policyConfigList.length > 1) { logger.debug("Too many configs for policyName: " + policyName); return null; } try { policyConfig = policyConfigList[0]; return this.getConfigFromStringJson(policyConfig.getConfig()); } catch (IOException e) { logger.error(e.getMessage()); return null; } } PolicyClientImpl(); PolicyDecision getDecision(String serviceType, String vnfType, String bbID, String workStep,
            String errorCode); DictionaryData getAllowedTreatments(String bbID, String workStep); @Override Config getConfigWithPolicyName(String policyName);  }### Answer:
@Test public void getConfigWithPolicyNameTest() throws IOException { PolicyClientImpl client = Mockito.spy(PolicyClientImpl.class); ObjectMapper mapper = new ObjectMapper(); mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false); PolicyConfig[] returnedPolicyConfigList = mapper.readValue(new File(RESOURCE_PATH + "policyConfig.json"), PolicyConfig[].class); Config expected = mapper.readValue(new File(RESOURCE_PATH + "configJson.json"), Config.class); PolicyRestClient mockedClient = Mockito.mock(PolicyRestClient.class); doReturn(mockedClient).when(client).getPolicyRestClient(PolicyServiceType.GET_CONFIG); doReturn(returnedPolicyConfigList).when(mockedClient).post(isA(ConfigRequestParameters.class), any()); Config actual = client.getConfigWithPolicyName("policyName"); assertThat(actual, sameBeanAs(expected)); }