package org.apache.commons.collections4.set;
import java.util.HashSet;
import java.util.Set;
import junit.framework.Test;
/**
* Extension of {@link AbstractSetTest} for exercising the
* {@link UnmodifiableSet} implementation.
*
* @version $Id$
* @since 3.0
*/
public class UnmodifiableSetTest<E> extends AbstractSetTest<E> {
public UnmodifiableSetTest(final String testName) {
super(testName);
}
public static Test suite() {
return org.apache.commons.collections4.BulkTest.makeSuite(UnmodifiableSetTest.class);
}
@Override
public Set<E> makeObject() {
return org.apache.commons.collections4.set.UnmodifiableSet.unmodifiableSet(new HashSet<E>());
}
@Override
public Set<E> makeFullCollection() {
final HashSet<E> set = new HashSet<E>();
set.addAll(java.util.Arrays.asList(getFullElements()));
return org.apache.commons.collections4.set.UnmodifiableSet.unmodifiableSet(set);
}
@Override
public boolean isAddSupported() {
return false;
}
@Override
public boolean isRemoveSupported() {
return false;
}
public void testUnmodifiable() {
fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testUnmodifiable");
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6288,((makeObject()) instanceof org.apache.commons.collections4.Unmodifiable));
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6289,((makeFullCollection()) instanceof org.apache.commons.collections4.Unmodifiable));
fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
public void testDecorateFactory() {
fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testDecorateFactory");
final Set<E> set = makeFullCollection();
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6285,set);
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6287,null,6286,org.apache.commons.collections4.set.UnmodifiableSet.unmodifiableSet(set));
try {
org.apache.commons.collections4.set.UnmodifiableSet.unmodifiableSet(null);
} catch (final IllegalArgumentException ex) {
}
fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
@org.junit.Test(timeout = 1000)
public void testDecorateFactory_add1982() {
fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testDecorateFactory_add1982");
final Set<E> set = makeFullCollection();
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6285,set);
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6287,null,6286,org.apache.commons.collections4.set.UnmodifiableSet.unmodifiableSet(set));
try {
org.apache.commons.collections4.set.UnmodifiableSet.unmodifiableSet(null);
org.apache.commons.collections4.set.UnmodifiableSet.unmodifiableSet(null);
} catch (final IllegalArgumentException ex) {
}
fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
@Override
public String getCompatibilityVersion() {
return "4";
}
}