Package org.apache.commons.collections4

Examples of org.apache.commons.collections4.MapUtilsTest


        try {
            executeAndThrow(input);
        } catch (final RuntimeException ex) {
            throw ex;
        } catch (final Throwable t) {
            throw new FunctorException(t);
        }
    }
View Full Code Here


            }

            try {
                return (T) iCloneMethod.invoke(iPrototype, (Object[]) null);
            } catch (final IllegalAccessException ex) {
                throw new FunctorException("PrototypeCloneFactory: Clone method must be public", ex);
            } catch (final InvocationTargetException ex) {
                throw new FunctorException("PrototypeCloneFactory: Clone method threw an exception", ex);
            }
        }
View Full Code Here

        }

        try {
            return iConstructor.newInstance(iArgs);
        } catch (final InstantiationException ex) {
            throw new FunctorException("InstantiateFactory: InstantiationException", ex);
        } catch (final IllegalAccessException ex) {
            throw new FunctorException("InstantiateFactory: Constructor must be public", ex);
        } catch (final InvocationTargetException ex) {
            throw new FunctorException("InstantiateFactory: Constructor threw an exception", ex);
        }
    }
View Full Code Here

     * @return true if decorated predicate returns true
     * @throws FunctorException if input is null
     */
    public boolean evaluate(final T object) {
        if (object == null) {
            throw new FunctorException("Input Object must not be null");
        }
        return iPredicate.evaluate(object);
    }
View Full Code Here

     * @return the transformed result
     */
    public T transform(final Class<? extends T> input) {
        try {
            if (input == null) {
                throw new FunctorException(
                    "InstantiateTransformer: Input object was not an instanceof Class, it was a null object");
            }
            final Constructor<? extends T> con = input.getConstructor(iParamTypes);
            return con.newInstance(iArgs);
        } catch (final NoSuchMethodException ex) {
            throw new FunctorException("InstantiateTransformer: The constructor must exist and be public ");
        } catch (final InstantiationException ex) {
            throw new FunctorException("InstantiateTransformer: InstantiationException", ex);
        } catch (final IllegalAccessException ex) {
            throw new FunctorException("InstantiateTransformer: Constructor must be public", ex);
        } catch (final InvocationTargetException ex) {
            throw new FunctorException("InstantiateTransformer: Constructor threw an exception", ex);
        }
    }
View Full Code Here

        assertNotSame(map1.hashCode(), map2.hashCode());
    }

    @SuppressWarnings({ "unchecked", "rawtypes" })
    public void testListValuedMapEqualsHashCodeContract() {
        ListValuedMap map1 = MultiValuedLinkedHashMap.listValuedLinkedHashMap();
        ListValuedMap map2 = MultiValuedLinkedHashMap.listValuedLinkedHashMap();

        map1.put("a", "a1");
        map1.put("a", "a2");
        map2.put("a", "a1");
        map2.put("a", "a2");
        assertEquals(map1, map2);
        assertEquals(map1.hashCode(), map2.hashCode());

        map1.put("b", "b1");
        map1.put("b", "b2");
        map2.put("b", "b2");
        map2.put("b", "b1");
        assertNotSame(map1, map2);
        assertNotSame(map1.hashCode(), map2.hashCode());
    }
View Full Code Here

        assertNotSame(map1.hashCode(), map2.hashCode());
    }

    @SuppressWarnings({ "unchecked", "rawtypes" })
    public void testListValuedMapEqualsHashCodeContract() {
        ListValuedMap map1 = MultiValuedHashMap.listValuedHashMap();
        ListValuedMap map2 = MultiValuedHashMap.listValuedHashMap();

        map1.put("a", "a1");
        map1.put("a", "a2");
        map2.put("a", "a1");
        map2.put("a", "a2");
        assertEquals(map1, map2);
        assertEquals(map1.hashCode(), map2.hashCode());

        map1.put("b", "b1");
        map1.put("b", "b2");
        map2.put("b", "b2");
        map2.put("b", "b1");
        assertNotSame(map1, map2);
        assertNotSame(map1.hashCode(), map2.hashCode());
    }
View Full Code Here

        }
    }

    @SuppressWarnings({ "unchecked", "rawtypes" })
    public void testEqualsHashCodeContract() {
        MultiValuedMap map1 = new MultiValuedLinkedHashMap();
        MultiValuedMap map2 = new MultiValuedLinkedHashMap();

        map1.put("a", "a1");
        map1.put("a", "a2");
        map2.put("a", "a2");
        map2.put("a", "a1");
        assertEquals(map1, map2);
        assertEquals(map1.hashCode(), map2.hashCode());

        map2.put("a", "a2");
        assertNotSame(map1, map2);
        assertNotSame(map1.hashCode(), map2.hashCode());
    }
View Full Code Here

        assertEquals(2, listMap.get("B").size());
    }

    @SuppressWarnings({ "unchecked", "rawtypes" })
    public void testEqualsHashCodeContract() {
        MultiValuedMap map1 = new MultiValuedHashMap();
        MultiValuedMap map2 = new MultiValuedHashMap();

        map1.put("a", "a1");
        map1.put("a", "a2");
        map2.put("a", "a2");
        map2.put("a", "a1");
        assertEquals(map1, map2);
        assertEquals(map1.hashCode(), map2.hashCode());

        map2.put("a", "a2");
        assertNotSame(map1, map2);
        assertNotSame(map1.hashCode(), map2.hashCode());
    }
View Full Code Here

        assertNotSame(map1.hashCode(), map2.hashCode());
    }

    @SuppressWarnings({ "unchecked", "rawtypes" })
    public void testSetValuedMapEqualsHashCodeContract() {
        SetValuedMap map1 = MultiValuedLinkedHashMap.setValuedLinkedHashMap();
        SetValuedMap map2 = MultiValuedLinkedHashMap.setValuedLinkedHashMap();

        map1.put("a", "a1");
        map1.put("a", "a2");
        map2.put("a", "a2");
        map2.put("a", "a1");
        assertEquals(map1, map2);
        assertEquals(map1.hashCode(), map2.hashCode());

        map2.put("a", "a2");
        assertEquals(map1, map2);
        assertEquals(map1.hashCode(), map2.hashCode());

        map2.put("a", "a3");
        assertNotSame(map1, map2);
        assertNotSame(map1.hashCode(), map2.hashCode());
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.collections4.MapUtilsTest

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.