@Test
  public void testFilterwithAssociation() {
    GenericFilterVO<ModuleVO> genericFilterVO =
        ServerGenericFilterBuilder.createGenericFilter(ModuleVO.class)
            .addCriteria(ModuleVO.FIELD_NAME, "module1")
            .getGenericFilter();
    genericFilterVO
        .addAssociation(ModuleVO.FIELD_MODULEDEFINITION)
        .addAssociation(ModuleDefinitionVO.FIELD_CLIENT);

    ModuleVO module = this.baseEntityService.filter(genericFilterVO).get(0);

    Assert.assertEquals("module1", module.getName());
    Assert.assertNotNull(module.getModuleDefinition());
    Assert.assertNotNull(module.getModuleDefinition().getClient());
  }
  @Before
  public void initTestData() {

    this.baseEntityService.deleteAll(ModuleNavigationVO.class.getName());
    this.baseEntityService.deleteAll(ModuleVO.class.getName());
    this.baseEntityService.deleteAll(ModuleDefinitionVO.class.getName());

    ClientVO client = new ClientVO();
    client.setName("xxx");

    ModuleDefinitionVO moduleDefinition1 = new ModuleDefinitionVO();
    moduleDefinition1.setName("moduledefinition1");
    moduleDefinition1.setClient(client);
    moduleDefinition1 = this.baseEntityService.create(moduleDefinition1);

    ModuleDefinitionVO moduleDefinition2 = new ModuleDefinitionVO();
    moduleDefinition2.setName("moduledefinition2");
    moduleDefinition2.setClient(client);
    moduleDefinition2 = this.baseEntityService.create(moduleDefinition2);

    ModuleVO module1 = new ModuleVO();
    module1.setName("module1");
    module1.setModuleDefinition(moduleDefinition1);
    module1 = this.baseEntityService.create(module1);

    ModuleVO module2 = new ModuleVO();
    module2.setName("module2");
    module2.setModuleDefinition(moduleDefinition2);
    module2 = this.baseEntityService.create(module2);

    ModuleNavigationVO navVO1 = new ModuleNavigationVO();
    navVO1.setLabel("nav1");
    navVO1.setModule(module1);
    navVO1 = this.baseEntityService.create(navVO1);

    ModuleNavigationVO navVO2 = new ModuleNavigationVO();
    navVO2.setLabel("nav2");
    navVO2.setModule(module2);

    navVO2.setParent(navVO1);
    navVO1.getChildren().add(navVO2);
    navVO2 = this.baseEntityService.create(navVO2);
  }