@Test
public void testGetOptimizationTemplateData() {

    logger.debug("testGetOptimizationTemplateData: enter");
    CreateOptimizationController controller = new CreateOptimizationController();
    MockHttpServletResponse response = new MockHttpServletResponse();
    String modelJson = "{\"policyData\":\"testPolicyBody\"}";
    try {
        CreateOptimizationController.setCommonClassDao(commonClassDao);
        BufferedReader br = new BufferedReader(new StringReader(modelJson));
        // mock the getReader() call
        when(request.getReader()).thenReturn(br);
        List<Object> optimizationModelsData = new ArrayList<Object>();
        OptimizationModels testData = new OptimizationModels();
        testData.setVersion("1707.4.1.2-Junit");
        optimizationModelsData.add(testData);
        // mock the getDataById() call with the same MS model name
        when(commonClassDao.getDataById(OptimizationModels.class, "modelName", "testPolicyBody"))
                .thenReturn(optimizationModelsData);
        controller.getOptimizationTemplateData(request, response);
        assertTrue(response.getContentAsString() != null
                && response.getContentAsString().contains("optimizationModelData"));
        logger.debug("response: " + response.getContentAsString());
    } catch (Exception e) {
        logger.error("testGetOptimizationTemplateData", e);
    }
    logger.debug("testGetOptimizationTemplateData: exit");
}