<commit_before>package au.com.centrumsystems.hudson.plugin.buildpipeline;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import hudson.model.FreeStyleBuild;
import hudson.model.FreeStyleProject;
import hudson.tasks.BuildTrigger;

import java.io.IOException;

import org.junit.Before;
import org.junit.Test;
import org.jvnet.hudson.test.HudsonTestCase;

public class ProjectFormTest extends HudsonTestCase {
    @Override
    @Before
    public void setUp() throws Exception {
        super.setUp();
    }

    @Test
    public void testConstructor() throws Exception {
        String proj1 = "Project1";
        String proj2 = "Project2";
        FreeStyleProject project1 = createFreeStyleProject(proj1);
        FreeStyleProject project2 = createFreeStyleProject(proj2);
        project1.getPublishersList().add(new BuildTrigger(proj2, false));
        hudson.rebuildDependencyGraph();
        FreeStyleBuild build1 = buildAndAssertSuccess(project1);
        waitUntilNoActivity();

        PipelineBuild pb = new PipelineBuild(build1, project1, null);
        ProjectForm pf = new ProjectForm(project1);
        assertEquals(project1.getName(), pf.getName());
        assertEquals(pb.getCurrentBuildResult(), pf.getResult());
        assertEquals(pb.getProjectURL(), pf.getUrl());
        assertEquals(pb.getUpstreamBuildResult(), pf.getHealth());
        assertThat(pf.getDependencies().get(0).getName(), is(project2.getName()));
    }

    @Test
    public void testEquals() throws IOException {
        String proj1 = "Project1";
        String proj2 = "Project2";
        FreeStyleProject project1 = createFreeStyleProject(proj1);
        FreeStyleProject project2 = createFreeStyleProject(proj2);
        project1.getPublishersList().add(new BuildTrigger(proj2, false));
        hudson.rebuildDependencyGraph();

        ProjectForm pf = new ProjectForm(project1);
        ProjectForm pf1 = new ProjectForm(project1);
        ProjectForm pf2 = new ProjectForm(project2);

        assertTrue(pf.equals(pf1));
        assertFalse(pf.equals(pf2));
    }
}<commit_msg>Updated testEquals to test null cases.<commit_after>package au.com.centrumsystems.hudson.plugin.buildpipeline;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import hudson.model.FreeStyleBuild;
import hudson.model.FreeStyleProject;
import hudson.tasks.BuildTrigger;

import java.io.IOException;

import org.junit.Before;
import org.junit.Test;
import org.jvnet.hudson.test.HudsonTestCase;

public class ProjectFormTest extends HudsonTestCase {
    @Override
    @Before
    public void setUp() throws Exception {
        super.setUp();
    }

    @Test
    public void testConstructor() throws Exception {
        String proj1 = "Project1";
        String proj2 = "Project2";
        FreeStyleProject project1 = createFreeStyleProject(proj1);
        FreeStyleProject project2 = createFreeStyleProject(proj2);
        project1.getPublishersList().add(new BuildTrigger(proj2, false));
        hudson.rebuildDependencyGraph();
        FreeStyleBuild build1 = buildAndAssertSuccess(project1);
        waitUntilNoActivity();

        PipelineBuild pb = new PipelineBuild(build1, project1, null);
        ProjectForm pf = new ProjectForm(project1);
        assertEquals(project1.getName(), pf.getName());
        assertEquals(pb.getCurrentBuildResult(), pf.getResult());
        assertEquals(pb.getProjectURL(), pf.getUrl());
        assertEquals(pb.getUpstreamBuildResult(), pf.getHealth());
        assertThat(pf.getDependencies().get(0).getName(), is(project2.getName()));
    }

    @Test
    public void testEquals() throws IOException {
        String proj1 = "Project1";
        String proj2 = "Project2";
        FreeStyleProject project1 = createFreeStyleProject(proj1);
        FreeStyleProject project2 = createFreeStyleProject(proj2);
        project1.getPublishersList().add(new BuildTrigger(proj2, false));
        hudson.rebuildDependencyGraph();

        ProjectForm pf = new ProjectForm(project1);
        ProjectForm pf1 = new ProjectForm(project1);
        ProjectForm pf2 = new ProjectForm(project2);
        String proj3 = null;
        ProjectForm pf3 = new ProjectForm(proj3);

        assertTrue(pf.equals(pf1));
        assertFalse(pf.equals(pf2));
        assertFalse(pf.equals(null));
        assertFalse(pf.equals(pf3));

    }
}
{'fraction_non_alphanumeric': 0.10463004993191104, 'fraction_numerical': 0.016795279164775308, 'mean_word_length': 3.614659685863874, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6893200', 'n_tokens_mistral': 1268, 'n_tokens_neox': 1226, 'n_words': 248}