Exemplo n.º 1
0
 @Test
 public void testInplaceReplace() {
   LNGVector<String> v1 = new LNGVector<>();
   for (int i = 0; i < 1000; i++) v1.push("s" + i);
   LNGVector<String> v2 = new LNGVector<>();
   for (int i = 0; i < 500; i++) v2.push("str" + i);
   LNGVector<String> v3 = new LNGVector<>();
   for (int i = 0; i < 2000; i++) v3.push("string" + i);
   v1.replaceInplace(v2);
   Assert.assertEquals(500, v1.size());
   for (int i = 0; i < 500; i++) Assert.assertEquals("str" + i, v1.get(i));
   v2.replaceInplace(v3);
   Assert.assertEquals(2000, v2.size());
   for (int i = 0; i < 2000; i++) Assert.assertEquals("string" + i, v2.get(i));
 }
Exemplo n.º 2
0
 @Test(expected = IllegalArgumentException.class)
 public void testIllegalInplaceReplace() {
   LNGVector<String> v1 = new LNGVector<>();
   for (int i = 0; i < 1000; i++) v1.push("s" + i);
   v1.replaceInplace(v1);
 }