congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
TestCompositeCollection
Code IndexAdd Tabnine to your IDE (free)

How to use
TestCompositeCollection
in
org.apache.commons.collections.collection

Best Java code snippets using org.apache.commons.collections.collection.TestCompositeCollection (Showing top 19 results out of 315)

origin: commons-collections/commons-collections

public void testAddAllToCollection() {
  setUpTest();
  one.add("1");
  two.add("2");
  c.addComposited(one, two);
  Collection toCollection = new HashSet();
  toCollection.addAll(c);
  assertTrue(toCollection.containsAll(c));
  assertEquals(c.size(), toCollection.size());
}   

origin: commons-collections/commons-collections

/**
 * Override testUnsupportedRemove, since the default impl expects removeAll,
 * retainAll and iterator().remove to throw
 */
public void testUnsupportedRemove() {    
  resetFull();
  try {
    collection.remove(null);
    fail("remove should raise UnsupportedOperationException");
  } catch (UnsupportedOperationException e) {
    // expected
  }
  verify();
}

origin: commons-collections/commons-collections

/**
 * Full collection should look like a collection with 4 elements
 */
public Collection makeConfirmedFullCollection() {
  Collection collection = new HashSet();
  collection.addAll(Arrays.asList(getFullElements()));
  return collection;
}

origin: commons-collections/commons-collections

public void testRemoveAll() {
  setUpMutatorTest();
  one.add("1");
  two.add("2");
  two.add("1");
  c.addComposited(one, two);
  c.removeAll(one);
  assertTrue(!c.contains("1"));
  assertTrue(!one.contains("1"));
  assertTrue(!two.contains("1"));
}

origin: commons-collections/commons-collections

public void testClear() {
  setUpTest();
  one.add("1");
  two.add("2");
  c.addComposited(one, two);
  c.clear();
  assertTrue(one.isEmpty());
  assertTrue(two.isEmpty());
  assertTrue(c.isEmpty());
}

origin: commons-collections/commons-collections

  public void testRemoveComposited() {
    setUpMutatorTest();
    one.add("1");
    two.add("2");
    two.add("1");
    c.addComposited(one, two);    
    c.removeComposited(one);
    assertTrue(c.contains("1"));
    assertEquals(c.size(), 2);
  }
}
origin: commons-collections/commons-collections

public void testSize() {
  setUpTest();
  HashSet set = new HashSet();
  set.add("a");
  set.add("b");
  c.addComposited(set);
  assertEquals(set.size(), c.size());
}

origin: commons-collections/commons-collections

protected void setUpMutatorTest() {
  setUpTest();
  c.setMutator(new CompositeCollection.CollectionMutator() {
    public boolean add(CompositeCollection composite, 
    Collection[] collections, Object obj) {
      for (int i = 0; i < collections.length; i++) {
        collections[i].add(obj);
      }
      return true;
    }
    
    public boolean addAll(CompositeCollection composite, 
    Collection[] collections, Collection coll) {
      for (int i = 0; i < collections.length; i++) {
        collections[i].addAll(coll);
      }
      return true;
    }
    
    public boolean remove(CompositeCollection composite, 
    Collection[] collections, Object obj) {
      for (int i = 0; i < collections.length; i++) {
        collections[i].remove(obj);
      }
      return true;
    }
  });
}
    
origin: commons-collections/commons-collections

public static Test suite() {
  TestSuite suite = new TestSuite();
  
  suite.addTest(TestCompositeCollection.suite());
  suite.addTest(TestPredicatedCollection.suite());
  suite.addTest(TestSynchronizedCollection.suite());
  suite.addTest(TestTransformedCollection.suite());
  suite.addTest(TestUnmodifiableCollection.suite());
  
  return suite;
}
  
origin: commons-collections/commons-collections

public void testRetainAll() {
  setUpTest();
  one.add("1");
  one.add("2");
  two.add("1");
  c.addComposited(one);
  c.retainAll(two);
  assertTrue(!c.contains("2"));
  assertTrue(!one.contains("2"));
  assertTrue(c.contains("1"));
  assertTrue(one.contains("1"));
}

origin: commons-collections/commons-collections

public void testRemove() {
  setUpMutatorTest();
  one.add("1");
  two.add("2");
  two.add("1");
  c.addComposited(one, two);
  c.remove("1");
  assertTrue(!c.contains("1"));
  assertTrue(!one.contains("1"));
  assertTrue(!two.contains("1"));
}

origin: commons-collections/commons-collections

public void testMultipleCollectionsSize() {
  setUpTest();
  HashSet set = new HashSet();
  set.add("a");
  set.add("b");
  c.addComposited(set);
  HashSet other = new HashSet();
  other.add("c");
  c.addComposited(other);
  assertEquals(set.size() + other.size(), c.size());
}

origin: commons-collections/commons-collections

public void testIsEmpty() {
  setUpTest();
  assertTrue(c.isEmpty());
  HashSet empty = new HashSet();
  c.addComposited(empty);
  assertTrue(c.isEmpty());
  empty.add("a");
  assertTrue(!c.isEmpty());
}

origin: commons-collections/commons-collections

public void testToCollection() {
  setUpTest();
  one.add("1");
  two.add("2");
  c.addComposited(one, two);
  Collection foo = c.toCollection();
  assertTrue(foo.containsAll(c));
  assertEquals(c.size(), foo.size());
  one.add("3");
  assertTrue(!foo.containsAll(c));
}

origin: commons-collections/commons-collections

/**
 * Full collection consists of 4 collections, each with one element
 */
public Collection makeFullCollection() {
  CompositeCollection compositeCollection = new CompositeCollection();
  Object[] elements = getFullElements();
  for (int i = 0; i < elements.length; i++) {
    Collection summand = new HashSet();
    summand.add(elements[i]);
    compositeCollection.addComposited(summand);
  }
  return compositeCollection;
}

origin: commons-collections/commons-collections

public void testContainsAll() {
  setUpTest();
  one.add("1");
  two.add("1");
  c.addComposited(one);
  assertTrue(c.containsAll(two));
}

origin: commons-collections/commons-collections

public void testIterator() {
  setUpTest();
  one.add("1");
  two.add("2");
  c.addComposited(one);
  c.addComposited(two);
  Iterator i = c.iterator();
  Object next = i.next();
  assertTrue(c.contains(next));
  assertTrue(one.contains(next));
  next = i.next();
  i.remove();
  assertTrue(!c.contains(next));
  assertTrue(!two.contains(next));
}

origin: commons-collections/commons-collections

public void testAddMutator() {
  setUpTest();
  c.setMutator(new CompositeCollection.CollectionMutator() {
    public boolean add(CompositeCollection composite, 
  assertTrue(c.contains("foo"));
  assertTrue(one.contains("foo"));
origin: commons-collections/commons-collections

public void testAddAllMutator() {
  setUpTest();
  c.setMutator(new CompositeCollection.CollectionMutator() {
    public boolean add(CompositeCollection composite, 
  two.add("foo");
  c.addAll(two);
  assertTrue(c.contains("foo"));
  assertTrue(one.contains("foo"));
org.apache.commons.collections.collectionTestCompositeCollection

Javadoc

Extension of AbstractTestCollection for exercising the CompositeCollection implementation.

Most used methods

  • assertEquals
  • assertTrue
  • fail
  • getFullElements
  • resetFull
  • setUpMutatorTest
  • setUpTest
  • suite
  • verify

Popular in Java

  • Making http requests using okhttp
  • getSharedPreferences (Context)
  • compareTo (BigDecimal)
  • onCreateOptionsMenu (Activity)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • Menu (java.awt)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now