AppPermissionDaoImpl implements AppPermissionDao { @Override public void addPermission(final String userUuid, final String permission) { JooqUtil.context(securityDbConnProvider, context -> { final Record user = context.fetchOne(STROOM_USER, STROOM_USER.UUID.eq(userUuid)); if (null == user) { throw new SecurityException(String.format("Could not find user: %s", userUuid)); } final AppPermissionRecord r = context.newRecord(APP_PERMISSION); r.setUserUuid(userUuid); r.setPermission(permission); r.store(); }); } @Inject  AppPermissionDaoImpl(final SecurityDbConnProvider securityDbConnProvider); @Override Set<String> getPermissionsForUser(final String userUuid); @Override Set<String> getPermissionsForUserName(String userName); @Override void addPermission(final String userUuid, final String permission); @Override void removePermission(final String userUuid, String permission);  }
@Test void testPermissionInvalidUser() { final String userUuid = UUID.randomUUID().toString(); assertThrows(SecurityException.class, () -> appPermissionDao.addPermission(userUuid, PERMISSION_NAME_1)); }