Package etherstrategy.simulation

Examples of etherstrategy.simulation.TestUElement


     * @throws Exception
     */
    @Test
    public void addingACollectionWithNullToAUniverseElementComposite() throws Exception
    {
        TestUElement element1 = new TestUElement();

        testElement.add (element1 );

        LinkedList<UniverseElement> testCollection =
            new LinkedList<UniverseElement>();

        testCollection.add( null );

        try
        {
            testElement.addAll( testCollection );
            fail("Adding a collection containing only nulls to a UniverseElementComposite should throw an exception, but did not.");
        }
        catch ( NullPointerException e )
        {
        }
        catch ( Exception e )
        {
            fail("Adding a collection containing only nulls to a UniverseElementComposite should throw only a NullPointerException, but a(n) " + e.getClass().getName() + " exception was thrown.");
        }

        assertTrue(
                "After failing to add a collection containing only nulls to a UniverseElementComposite, the UniverseElementComposite should not have changed.",
                testElement.size() == 1
                && testElement.contains( element1 ) );

        testCollection.clear();
        testCollection.add( new TestUElement() );
        testCollection.add( null );
        testCollection.add( new TestUElementComposite() );

        try
        {
            testElement.addAll( testCollection );
            fail("Adding a collection with a null reference and other valid elements should throw a NullPointerException due to the null reference, but did not.");
        }
        catch ( NullPointerException e )
        {
        }
        catch ( Exception e )
        {
            fail("Adding a collection containing a null to a UniverseElementComposite should throw only a NullPointerException, but a(n) " + e.getClass().getName() + " exception was thrown.");
        }

        assertTrue(
                "After failing to add a collection with a null reference to a UniverseElementComposite, the UniverseElementComposite should not have changed.",
                testElement.size() == 1
                && testElement.contains( element1 ) );

        testCollection.clear();
        testCollection.add( new TestUElementComposite() );
        testCollection.add( new TestUElement() );
        testCollection.add( null );

        try
        {
            testElement.addAll( testCollection );
            fail("Adding a collection with valid elements and a null reference as the last element should throw a NullPointerException due to the null reference, but did not.");
        }
        catch ( NullPointerException e )
        {
        }
        catch ( Exception e )
        {
            fail("Adding a collection containing a null reference as the last element to a UniverseElementComposite should throw only a NullPointerException, but a(n) " + e.getClass().getName() + " exception was thrown.");
        }

        assertTrue(
                "After failing to add a collection with a null reference to a UniverseElementComposite, the UniverseElementComposite should not have changed.",
                testElement.size() == 1
                && testElement.contains( element1 ) );

        testCollection.clear();
        testCollection.add( null );
        testCollection.add( new TestUElementComposite() );
        testCollection.add( new TestUElement() );

        try
        {
            testElement.addAll( testCollection );
            fail("Adding a collection with valid elements and a null reference as the first element should throw a NullPointerException due to the null reference, but did not.");
View Full Code Here


        LinkedList<Object> testCollection =
            new LinkedList<Object>();
        LinkedList<Object> emptyCollection =
            new LinkedList<Object>();

        TestUElement element1 = new TestUElement();
        TestUElementComposite element2 = new TestUElementComposite();
        TestUElement element3 = new TestUElement();

        testCollection.add(element1);
        testCollection.add(element2);
       
        /*
 
View Full Code Here

        LinkedList<Object> testCollection =
            new LinkedList<Object>();
        LinkedList<Object> emptyCollection =
            new LinkedList<Object>();

        TestUElement element1 = new TestUElement();
        TestUElementComposite element2 = new TestUElementComposite();
        TestUElement element3 = new TestUElement();
        TestUElement element4 = new TestUElement();

        testCollection.add(element1);
        testCollection.add(element2);
       
        assertFalse(
View Full Code Here

     * @throws Exception
     */
    @Test
    public void removingANullCollectionFromUniverseElementComposite() throws Exception
    {
        TestUElement element1 = new TestUElement();

        testElement.add(element1);

        try
        {
View Full Code Here

        LinkedList<Object> testCollection =
            new LinkedList<Object>();
        LinkedList<UniverseElement> checkCollection =
            new LinkedList<UniverseElement>();

        TestUElement element1 = new TestUElement();
        TestUElementComposite element2 = new TestUElementComposite();
        TestUElement element3 = new TestUElement();
        TestUElement element4 = new TestUElement();

        checkCollection.add( element1 );
        checkCollection.add( element2 );
        checkCollection.add( element3 );
        checkCollection.add( element4 );
View Full Code Here

        LinkedList<UniverseElement> testCollection =
            new LinkedList<UniverseElement>();
        LinkedList<UniverseElement> checkCollection =
            new LinkedList<UniverseElement>();

        TestUElement element1 = new TestUElement();
        TestUElementComposite element2 = new TestUElementComposite();
        TestUElement element3 = new TestUElement();
        TestUElement element4 = new TestUElement();

        checkCollection.add( element1 );
        checkCollection.add( element2 );
        checkCollection.add( element3 );
        checkCollection.add( element4 );
View Full Code Here

        LinkedList<Object> testCollection =
            new LinkedList<Object>();
        LinkedList<Object> emptyCollection =
            new LinkedList<Object>();

        TestUElement element1 = new TestUElement();
        TestUElementComposite element2 = new TestUElementComposite();
        TestUElement element3 = new TestUElement();
        TestUElement element4 = new TestUElement();

        testCollection.add(element1);
        testCollection.add(element2);
       
        assertFalse(
View Full Code Here

     * @throws Exception
     */
    @Test
    public void retainingANullCollectionInUniverseElementComposite() throws Exception
    {
        TestUElement element1 = new TestUElement();

        testElement.add(element1);

        try
        {
View Full Code Here

        LinkedList<Object> testCollection =
            new LinkedList<Object>();
        LinkedList<UniverseElement> checkCollection =
            new LinkedList<UniverseElement>();

        TestUElement element1 = new TestUElement();
        TestUElementComposite element2 = new TestUElementComposite();
        TestUElement element3 = new TestUElement();
        TestUElement element4 = new TestUElement();

        checkCollection.add( element1 );
        checkCollection.add( element2 );
        checkCollection.add( element3 );
        checkCollection.add( element4 );
View Full Code Here

        LinkedList<UniverseElement> testCollection =
            new LinkedList<UniverseElement>();
        LinkedList<UniverseElement> checkCollection =
            new LinkedList<UniverseElement>();

        TestUElement element1 = new TestUElement();
        TestUElementComposite element2 = new TestUElementComposite();
        TestUElement element3 = new TestUElement();
        TestUElement element4 = new TestUElement();

        checkCollection.add( element1 );
        checkCollection.add( element2 );
        checkCollection.add( element3 );
        checkCollection.add( element4 );
View Full Code Here

TOP

Related Classes of etherstrategy.simulation.TestUElement

Copyright © 2018 www.massapicom. 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.