@Test
  public void
      initializeDatabaseTest_InitOk_ThrowsCantInitializeNetworkServicesWalletResourcesDatabaseException()
          throws Exception {

    catchException(subAppResourcesInstallationNetworkServiceDAO)
        .initializeDatabase(
            testOwnerId, SubAppResourcesNetworkServiceDatabaseConstants.DATABASE_NAME);
    assertThat(CatchException.<Exception>caughtException()).isNull();
  }
  @Test
  public void
      initializeDatabaseTest_InitSucefuly_throwsCantInitializeIntraUserActorDatabaseException()
          throws Exception {

    intraWalletUserActorDao =
        new IntraWalletUserActorDao(mockPluginDatabaseSystem, mockPluginFileSystem, pluginId);

    catchException(intraWalletUserActorDao).initializeDatabase();
    assertThat(CatchException.<Exception>caughtException()).isNull();
  }
  @Test
  public void
      initializeDatabaseTest_ErrorNoFound_ThrowsCantInitializeNetworkServicesWalletResourcesDatabaseException()
          throws Exception {

    when(mockPluginDatabaseSystem.openDatabase(any(UUID.class), anyString()))
        .thenThrow(DatabaseNotFoundException.class);
    catchException(subAppResourcesInstallationNetworkServiceDAO)
        .initializeDatabase(
            testOwnerId, SubAppResourcesNetworkServiceDatabaseConstants.DATABASE_NAME);
    assertThat(CatchException.<Exception>caughtException()).isNotNull();
  }
  @Test
  public void testScopedMacro() {
    CriteriaBuilder<Document> cb = cbf.create(em, Document.class, "d");
    CatchException.verifyException(cb, SyntaxErrorException.class).where("ID(d)");

    cb.registerMacro(
        "id",
        new JpqlMacro() {
          @Override
          public void render(FunctionRenderContext context) {
            context.addArgument(0);
            context.addChunk(".id");
          }
        });
    cb.where("ID(d)").eq(1);
    String expected = "SELECT d FROM Document d WHERE d.id = :param_0";
    assertEquals(expected, cb.getQueryString());

    CriteriaBuilder<Document> newCb = cbf.create(em, Document.class, "d");
    CatchException.verifyException(newCb, SyntaxErrorException.class).where("ID(d)");
  }