Package org.junit.tests.description

Source Code of org.junit.tests.description.SuiteDescriptionTest

package org.junit.tests.description;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

import org.junit.Test;
import org.junit.runner.Description;

public class SuiteDescriptionTest {
    Description childless = Description.createSuiteDescription("a");
    Description anotherChildless = Description.createSuiteDescription("a");
    Description namedB = Description.createSuiteDescription("b");

    Description twoKids = descriptionWithTwoKids("foo", "bar");
    Description anotherTwoKids = descriptionWithTwoKids("foo", "baz");

    @Test
    public void equalsIsCorrect() {
        assertEquals(childless, anotherChildless);
        assertFalse(childless.equals(namedB));
        assertEquals(childless, twoKids);
        assertEquals(twoKids, anotherTwoKids);
        assertFalse(twoKids.equals(new Integer(5)));
    }

    @Test
    public void hashCodeIsReasonable() {
        assertEquals(childless.hashCode(), anotherChildless.hashCode());
        assertFalse(childless.hashCode() == namedB.hashCode());
    }

    private Description descriptionWithTwoKids(String first, String second) {
        Description twoKids = Description.createSuiteDescription("a");
        twoKids.addChild(Description.createTestDescription(getClass(), first));
        twoKids.addChild(Description.createTestDescription(getClass(), second));
        return twoKids;
    }
}
TOP

Related Classes of org.junit.tests.description.SuiteDescriptionTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.