@Test
public void testSave() {

    OptimizationDictionaryController controller = new OptimizationDictionaryController(commonClassDao);
    MockHttpServletRequest req = new MockHttpServletRequest();
    MockHttpServletResponse response = new MockHttpServletResponse();
    req.setBodyContent("{\n\"modelType\": \"type.yml\", \"dataOrderInfo\": \"info\", \"userid\": \"id\", "
        + "\"optimizationModelsDictionaryData\": {\"description\": \"desc\", \"modelName\": \"name\", \"version\": \"1.0\"}, "
        + "\"classMap\": \"{\\\"dep\\\":\\\"{\\\"dependency\\\":\\\"depval\\\"}\\\"}\" }\n");
    assertThatThrownBy(() -> controller.saveOptimizationModelsDictionary(req, response))
        .isInstanceOf(NullPointerException.class);
    req.setBodyContent("{\n\"modelType\": \"type.xml\", \"dataOrderInfo\": \"info\", \"userid\": \"id\", "
        + "\"optimizationModelsDictionaryData\": {\"description\": \"desc\", \"modelName\": \"name\", \"version\": \"1.0\"}, "
        + "\"classMap\": \"{\\\"dep\\\": {\\\"dependency\\\":\\\"depval\\\"} }\" }\n");
    assertThatCode(() -> controller.saveOptimizationModelsDictionary(req, response)).doesNotThrowAnyException();
    req.setupAddParameter("apiflag", "api");
    assertThatThrownBy(() -> controller.saveOptimizationModelsDictionary(req, response))
        .isInstanceOf(NullPointerException.class);
}