< prev index next >

test/src/main/java/org/openjdk/skara/test/TestPullRequest.java

Print this page
*** 37,36 ***
      private final String id;
      private final HostUserDetails author;
      private final HostUserDetails user;
      private final String targetRef;
      private final String sourceRef;
-     private final String title;
-     private final List<String> body;
      private final PullRequestData data;
  
      private static class PullRequestData {
          private Hash headHash;
          PullRequest.State state = PullRequest.State.OPEN;
          String body = "";
          final List<Comment> comments = new ArrayList<>();
          final List<ReviewComment> reviewComments = new ArrayList<>();
          final Set<Check> checks = new HashSet<>();
          final Set<String> labels = new HashSet<>();
          final List<Review> reviews = new ArrayList<>();
          ZonedDateTime created = ZonedDateTime.now();
          ZonedDateTime lastUpdate = created;
      }
  
!     private TestPullRequest(TestHostedRepository repository, String id, HostUserDetails author, HostUserDetails user, String targetRef, String sourceRef, String title, List<String> body, PullRequestData data) {
          this.repository = repository;
          this.id = id;
          this.author = author;
          this.user = user;
          this.targetRef = targetRef;
-         this.title = title;
-         this.body = body;
          this.data = data;
  
          try {
              var headHash = repository.localRepository().resolve(sourceRef).orElseThrow();
              if (!headHash.equals(data.headHash)) {
--- 37,33 ---
      private final String id;
      private final HostUserDetails author;
      private final HostUserDetails user;
      private final String targetRef;
      private final String sourceRef;
      private final PullRequestData data;
  
      private static class PullRequestData {
          private Hash headHash;
          PullRequest.State state = PullRequest.State.OPEN;
          String body = "";
+         String title = "";
          final List<Comment> comments = new ArrayList<>();
          final List<ReviewComment> reviewComments = new ArrayList<>();
          final Set<Check> checks = new HashSet<>();
          final Set<String> labels = new HashSet<>();
          final List<Review> reviews = new ArrayList<>();
          ZonedDateTime created = ZonedDateTime.now();
          ZonedDateTime lastUpdate = created;
      }
  
!     private TestPullRequest(TestHostedRepository repository, String id, HostUserDetails author, HostUserDetails user, String targetRef, String sourceRef, PullRequestData data) {
          this.repository = repository;
          this.id = id;
          this.author = author;
          this.user = user;
          this.targetRef = targetRef;
          this.data = data;
  
          try {
              var headHash = repository.localRepository().resolve(sourceRef).orElseThrow();
              if (!headHash.equals(data.headHash)) {

*** 78,17 ***
          }
      }
  
      static TestPullRequest createNew(TestHostedRepository repository, String id, String targetRef, String sourceRef, String title, List<String> body) {
          var data = new PullRequestData();
          data.body = String.join("\n", body);
!         var pr = new TestPullRequest(repository, id, repository.host().getCurrentUserDetails(), repository.host().getCurrentUserDetails(), targetRef, sourceRef, title, body, data);
          return pr;
      }
  
      static TestPullRequest createFrom(TestHostedRepository repository, TestPullRequest other) {
!         var pr = new TestPullRequest(repository, other.id, other.author, repository.host().getCurrentUserDetails(), other.targetRef, other.sourceRef, other.title, other.body, other.data);
          return pr;
      }
  
      @Override
      public HostedRepository repository() {
--- 75,18 ---
          }
      }
  
      static TestPullRequest createNew(TestHostedRepository repository, String id, String targetRef, String sourceRef, String title, List<String> body) {
          var data = new PullRequestData();
+         data.title = title;
          data.body = String.join("\n", body);
!         var pr = new TestPullRequest(repository, id, repository.host().getCurrentUserDetails(), repository.host().getCurrentUserDetails(), targetRef, sourceRef, data);
          return pr;
      }
  
      static TestPullRequest createFrom(TestHostedRepository repository, TestPullRequest other) {
!         var pr = new TestPullRequest(repository, other.id, other.author, repository.host().getCurrentUserDetails(), other.targetRef, other.sourceRef, other.data);
          return pr;
      }
  
      @Override
      public HostedRepository repository() {

*** 170,11 ***
          return repository.getBranchHash(targetRef);
      }
  
      @Override
      public String getTitle() {
!         return title;
      }
  
      @Override
      public String getBody() {
          return data.body;
--- 168,17 ---
          return repository.getBranchHash(targetRef);
      }
  
      @Override
      public String getTitle() {
!         return data.title;
+     }
+ 
+     @Override
+     public void setTitle(String title) {
+         data.title = title;
+         data.lastUpdate = ZonedDateTime.now();
      }
  
      @Override
      public String getBody() {
          return data.body;
< prev index next >