// Path: src/main/java/org/jenkinsci/plugins/github/config/GitHubServerConfig.java
// public static final String GITHUB_URL = "https://api.github.com";
// 
// Path: src/main/java/org/jenkinsci/plugins/github/config/GitHubServerConfig.java
// public static Predicate<GitHubServerConfig> allowedToManageHooks() {
//     return new NullSafePredicate<GitHubServerConfig>() {
//         @Override
//         protected boolean applyNullSafe(@NonNull GitHubServerConfig github) {
//             return github.isManageHooks();
//         }
//     };
// }
// 
// Path: src/main/java/org/jenkinsci/plugins/github/config/GitHubServerConfig.java
// public static boolean isUrlCustom(String apiUrl) {
//     return isNotBlank(apiUrl) && !GITHUB_URL.equals(apiUrl);
// }
// 
// Path: src/main/java/org/jenkinsci/plugins/github/config/GitHubServerConfig.java
// public static Predicate<GitHubServerConfig> withHost(final String host) {
//     return new NullSafePredicate<GitHubServerConfig>() {
//         @Override
//         protected boolean applyNullSafe(@NonNull GitHubServerConfig github) {
//             return defaultIfEmpty(github.getApiUrl(), GITHUB_URL).contains(host);
//         }
//     };
// }


import org.junit.Test;
import java.net.URI;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;
import static org.jenkinsci.plugins.github.config.GitHubServerConfig.GITHUB_URL;
import static org.jenkinsci.plugins.github.config.GitHubServerConfig.allowedToManageHooks;
import static org.jenkinsci.plugins.github.config.GitHubServerConfig.isUrlCustom;
import static org.jenkinsci.plugins.github.config.GitHubServerConfig.withHost;
import static org.junit.Assert.assertThat;

    @Test
    public void shouldMatchNonEqualToGHUrl() throws Exception {
          assertThat(isUrlCustom(CUSTOM_GH_SERVER), is(true));
    }

    @Test
    public void shouldNotMatchEmptyUrl() throws Exception {
          assertThat(isUrlCustom(""), is(false));
    }

    @Test
    public void shouldNotMatchNullUrl() throws Exception {
          assertThat(isUrlCustom(null), is(false));
    }

    @Test
    public void shouldNotMatchDefaultUrl() throws Exception {
          assertThat(isUrlCustom(GITHUB_URL), is(false));
    }

    @Test
    public void shouldMatchDefaultConfigWithGHDefaultHost() throws Exception {
        assertThat(withHost(DEFAULT_GH_API_HOST).apply(new GitHubServerConfig("")), is(true));
    }

    @Test
    public void shouldNotMatchNonDefaultConfigWithGHDefaultHost() throws Exception {
        GitHubServerConfig input = new GitHubServerConfig("");
        input.setApiUrl(CUSTOM_GH_SERVER);
// Path: src/main/java/org/jenkinsci/plugins/github/config/GitHubServerConfig.java
// public static final String GITHUB_URL = "https://api.github.com";
// 
// Path: src/main/java/org/jenkinsci/plugins/github/config/GitHubServerConfig.java
// public static Predicate<GitHubServerConfig> allowedToManageHooks() {
//     return new NullSafePredicate<GitHubServerConfig>() {
//         @Override
//         protected boolean applyNullSafe(@NonNull GitHubServerConfig github) {
//             return github.isManageHooks();
//         }
//     };
// }
// 
// Path: src/main/java/org/jenkinsci/plugins/github/config/GitHubServerConfig.java
// public static boolean isUrlCustom(String apiUrl) {
//     return isNotBlank(apiUrl) && !GITHUB_URL.equals(apiUrl);
// }
// 
// Path: src/main/java/org/jenkinsci/plugins/github/config/GitHubServerConfig.java
// public static Predicate<GitHubServerConfig> withHost(final String host) {
//     return new NullSafePredicate<GitHubServerConfig>() {
//         @Override
//         protected boolean applyNullSafe(@NonNull GitHubServerConfig github) {
//             return defaultIfEmpty(github.getApiUrl(), GITHUB_URL).contains(host);
//         }
//     };
// }


// Path: src/test/java/org/jenkinsci/plugins/github/config/GitHubServerConfigTest.java
import org.junit.Test;
import java.net.URI;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;
import static org.jenkinsci.plugins.github.config.GitHubServerConfig.GITHUB_URL;
import static org.jenkinsci.plugins.github.config.GitHubServerConfig.allowedToManageHooks;
import static org.jenkinsci.plugins.github.config.GitHubServerConfig.isUrlCustom;
import static org.jenkinsci.plugins.github.config.GitHubServerConfig.withHost;
import static org.junit.Assert.assertThat;


    @Test
    public void shouldMatchNonEqualToGHUrl() throws Exception {
          assertThat(isUrlCustom(CUSTOM_GH_SERVER), is(true));
    }

    @Test
    public void shouldNotMatchEmptyUrl() throws Exception {
          assertThat(isUrlCustom(""), is(false));
    }

    @Test
    public void shouldNotMatchNullUrl() throws Exception {
          assertThat(isUrlCustom(null), is(false));
    }

    @Test
    public void shouldNotMatchDefaultUrl() throws Exception {
          assertThat(isUrlCustom(GITHUB_URL), is(false));
    }

    @Test
    public void shouldMatchDefaultConfigWithGHDefaultHost() throws Exception {
        assertThat(withHost(DEFAULT_GH_API_HOST).apply(new GitHubServerConfig("")), is(true));
    }

    @Test
    public void shouldNotMatchNonDefaultConfigWithGHDefaultHost() throws Exception {
        GitHubServerConfig input = new GitHubServerConfig("");
        input.setApiUrl(CUSTOM_GH_SERVER);
        assertThat(withHost(DEFAULT_GH_API_HOST).apply(input), is(false));