@Test public void map() { final RequestDto requestDto = RequestDtoMother.fundRequestArea51(); final IssueInformationDto issueInformation = requestDto.getIssueInformation(); final String status = "rdfjcgv"; final GithubResult githubResult = new GithubResult(); githubResult.setBodyHtml("<html/>"); when(delegate.map(requestDto)).thenReturn(new RequestDetailsView()); when(githubGateway.getIssue(issueInformation.getOwner(), issueInformation.getRepo(), issueInformation.getNumber())).thenReturn(githubResult); when(enumToCapitalizedStringMapper.map(requestDto.getStatus())).thenReturn(status); final RequestDetailsView result = decorator.map(requestDto); assertThat(result.getIcon()).isEqualTo("https: assertThat(result.getPlatform()).isEqualTo(issueInformation.getPlatform().name()); assertThat(result.getOwner()).isEqualTo(issueInformation.getOwner()); assertThat(result.getRepo()).isEqualTo(issueInformation.getRepo()); assertThat(result.getIssueNumber()).isEqualTo(issueInformation.getNumber()); assertThat(result.getTitle()).isEqualTo(issueInformation.getTitle()); assertThat(result.getStarred()).isEqualTo(requestDto.isLoggedInUserIsWatcher()); assertThat(result.getStatus()).isEqualTo(status); assertThat(result.getDescription()).isEqualTo(githubResult.getBodyHtml()); }
@Override public RequestDetailsView map(RequestDto r) { RequestDetailsView view = delegate.map(r); if (view != null) { IssueInformationDto issueInfo = r.getIssueInformation(); view.setIcon("https: view.setPlatform(issueInfo.getPlatform().name()); view.setOwner(issueInfo.getOwner()); view.setRepo(issueInfo.getRepo()); view.setIssueNumber(issueInfo.getNumber()); view.setTitle(issueInfo.getTitle()); view.setStarred(r.isLoggedInUserIsWatcher()); view.setDescription(githubGateway.getIssue(issueInfo.getOwner(), issueInfo.getRepo(), issueInfo.getNumber()).getBodyHtml()); view.setPhase(enumToCapitalizedStringMapper.map(r.getStatus().getPhase())); view.setStatus(enumToCapitalizedStringMapper.map(r.getStatus())); } return view; }
RequestDetailsViewMapperDecorator implements RequestDetailsViewMapper { @Override public RequestDetailsView map(RequestDto r) { RequestDetailsView view = delegate.map(r); if (view != null) { IssueInformationDto issueInfo = r.getIssueInformation(); view.setIcon("https: view.setPlatform(issueInfo.getPlatform().name()); view.setOwner(issueInfo.getOwner()); view.setRepo(issueInfo.getRepo()); view.setIssueNumber(issueInfo.getNumber()); view.setTitle(issueInfo.getTitle()); view.setStarred(r.isLoggedInUserIsWatcher()); view.setDescription(githubGateway.getIssue(issueInfo.getOwner(), issueInfo.getRepo(), issueInfo.getNumber()).getBodyHtml()); view.setPhase(enumToCapitalizedStringMapper.map(r.getStatus().getPhase())); view.setStatus(enumToCapitalizedStringMapper.map(r.getStatus())); } return view; } }
RequestDetailsViewMapperDecorator implements RequestDetailsViewMapper { @Override public RequestDetailsView map(RequestDto r) { RequestDetailsView view = delegate.map(r); if (view != null) { IssueInformationDto issueInfo = r.getIssueInformation(); view.setIcon("https: view.setPlatform(issueInfo.getPlatform().name()); view.setOwner(issueInfo.getOwner()); view.setRepo(issueInfo.getRepo()); view.setIssueNumber(issueInfo.getNumber()); view.setTitle(issueInfo.getTitle()); view.setStarred(r.isLoggedInUserIsWatcher()); view.setDescription(githubGateway.getIssue(issueInfo.getOwner(), issueInfo.getRepo(), issueInfo.getNumber()).getBodyHtml()); view.setPhase(enumToCapitalizedStringMapper.map(r.getStatus().getPhase())); view.setStatus(enumToCapitalizedStringMapper.map(r.getStatus())); } return view; }  }
RequestDetailsViewMapperDecorator implements RequestDetailsViewMapper { @Override public RequestDetailsView map(RequestDto r) { RequestDetailsView view = delegate.map(r); if (view != null) { IssueInformationDto issueInfo = r.getIssueInformation(); view.setIcon("https: view.setPlatform(issueInfo.getPlatform().name()); view.setOwner(issueInfo.getOwner()); view.setRepo(issueInfo.getRepo()); view.setIssueNumber(issueInfo.getNumber()); view.setTitle(issueInfo.getTitle()); view.setStarred(r.isLoggedInUserIsWatcher()); view.setDescription(githubGateway.getIssue(issueInfo.getOwner(), issueInfo.getRepo(), issueInfo.getNumber()).getBodyHtml()); view.setPhase(enumToCapitalizedStringMapper.map(r.getStatus().getPhase())); view.setStatus(enumToCapitalizedStringMapper.map(r.getStatus())); } return view; }  @Override RequestDetailsView map(RequestDto r); }
RequestDetailsViewMapperDecorator implements RequestDetailsViewMapper { @Override public RequestDetailsView map(RequestDto r) { RequestDetailsView view = delegate.map(r); if (view != null) { IssueInformationDto issueInfo = r.getIssueInformation(); view.setIcon("https: view.setPlatform(issueInfo.getPlatform().name()); view.setOwner(issueInfo.getOwner()); view.setRepo(issueInfo.getRepo()); view.setIssueNumber(issueInfo.getNumber()); view.setTitle(issueInfo.getTitle()); view.setStarred(r.isLoggedInUserIsWatcher()); view.setDescription(githubGateway.getIssue(issueInfo.getOwner(), issueInfo.getRepo(), issueInfo.getNumber()).getBodyHtml()); view.setPhase(enumToCapitalizedStringMapper.map(r.getStatus().getPhase())); view.setStatus(enumToCapitalizedStringMapper.map(r.getStatus())); } return view; }  @Override RequestDetailsView map(RequestDto r);  }