### Question:
UserRoleFromContextService { public UserContextRole getUserRoleInNoteId(Long noteId) { Note contextNote = noteRepository.findByIdOrThrow(noteId); UUID currentUserId = userService.getCurrentUser().getId(); if (contextNote.getUserId().equals(currentUserId)) { return UserContextRole.ENTITYOWNER; } return UserContextRole.USER; } @Autowired  UserRoleFromContextService(
      UnitRepository<OkrChildUnit> unitRepository,
      ObjectiveRepository objectiveRepository,
      KeyResultRepository keyResultRepository,
      NoteRepository noteRepository,
      AdminUserRepository adminUserRepository,
      UserService userService); UserContextRole getUserRoleWithoutContext(); UserContextRole getUserRoleInUnitId(Long unitId); UserContextRole getUserRoleInObjectiveId(Long objectiveId); UserContextRole getUserRoleInKeyResultId(Long keyResultId); UserContextRole getUserRoleInNoteId(Long noteId); UserContextRole getUserRoleInUnit(OkrUnit okrUnit);  }### Answer:
@Test public void getRoleFromNote_Owner_expectedOwnerRole() { when(currentUser.getId()).thenReturn(noteOwnerId); UserContextRole actualRole = userRoleFromContextService.getUserRoleInNoteId(noteId); Assert.assertEquals(UserContextRole.ENTITYOWNER, actualRole); }
@Test public void getRoleFromNote_User_expectedUserRole() { when(currentUser.getId()).thenReturn(unrelatedUserId); UserContextRole actualRole = userRoleFromContextService.getUserRoleInNoteId(noteId); Assert.assertEquals(UserContextRole.USER, actualRole); }