Added GHBranch creator

Added GHBranch creator and added a test to make sure it works
This commit is contained in:
Alex Taylor
2019-11-15 10:54:32 -05:00
parent 834c84c9ea
commit 8d50b338f4
2 changed files with 13 additions and 4 deletions

View File

@@ -1,8 +1,8 @@
package org.kohsuke.github;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.IOException;
import java.net.URL;
import java.util.Collection;
@@ -26,7 +26,15 @@ public class GHBranch {
private boolean protection;
private String protection_url;
@JsonCreator
GHBranch(@JsonProperty("name") String name) throws Exception{
if (name != null) {
this.name = name;
}
else{
throw new GHFileNotFoundException("Branch Not Found");
}
}
public static class Commit {
String sha;