public void checkActor(Message input) { int actId; int inputId; boolean res; actId = actorService.findByPrincipal().getUserAccount().getId(); inputId = input.getSender().getUserAccount().getId(); res = false; if (actId == inputId) { res = true; } else { for (Actor a : input.getRecipients()) { inputId = a.getUserAccount().getId(); if (actId == inputId) { res = true; break; } } } Assert.isTrue(res, "message.consult.notOwner"); }