private DefaultWidgetInstance prepareData(ObjectMapper objectMapper)
      throws JsonProcessingException {

    AbstractLicensableWidget widget = new UserProductivityWidget();
    widget.setId(1l);
    widget.setName("user-productivity-widget");
    Canvas perishableCanvas = new Canvas();
    perishableCanvas.setName("Perishable Goods Canvas");
    perishableCanvas.setShortName("shortName");
    perishableCanvas.setCanvasType(CanvasType.PRIVATE);
    perishableCanvas.setCanvasId(1l);
    DefaultWidgetInstance defaultWidgetInstance = new DefaultWidgetInstance();
    defaultWidgetInstance.setActualViewConfig(objectMapper.writeValueAsString(actualViewConfig));
    defaultWidgetInstance.setCanvas(perishableCanvas);
    defaultWidgetInstance.setWidgetinstanceId(1l);
    defaultWidgetInstance.setWidget(widget);

    return defaultWidgetInstance;
  }
  @Transactional
  @Rollback(true)
  @Test
  public void testCreateWidgetInstance()
      throws IllegalArgumentException, IllegalAccessException, InvocationTargetException,
          SecurityException, NoSuchMethodException, IOException {
    ObjectMapper objectMapper = new ObjectMapper();

    DefaultWidgetInstance defaultWidgetInstance = prepareData(objectMapper);

    defaultWidgetInstance.setWidgetinstanceId(null);

    Map<String, String> responsMap = uIService.createOrUpdateWidgetInstance(defaultWidgetInstance);
    Assert.isTrue(
        responsMap.get("widgetInstanceAction").equals("create"),
        "The response action should have been 'create'");
    Canvas retrievedPerishableCanvas = uIService.getCanvasByName("Perishable Goods Canvas");
    List<DefaultWidgetInstance> retrievedDefaultWidgetInstances =
        retrievedPerishableCanvas.getWidgetInstanceList();

    Assert.isTrue(retrievedDefaultWidgetInstances.size() == 6);
  }