Skip to content

Instantly share code, notes, and snippets.

@gary-liguoliang
Created June 21, 2014 03:21
Show Gist options
  • Save gary-liguoliang/f673fb031daccf42e1dd to your computer and use it in GitHub Desktop.
Save gary-liguoliang/f673fb031daccf42e1dd to your computer and use it in GitHub Desktop.
package com.liguoliang.lang.collection;
import static org.junit.Assert.*;
import java.util.Iterator;
import org.junit.Before;
import org.junit.Test;
public class GListTest {
GList<String> list = null;
@Before
public void setup() {
list = new GList<>();
}
@Test
public void testAdd() {
list.add("String - 1");
assertEquals(1, list.getSize());
}
@Test
public void testItrate() {
String[] input = new String[]{"S1", "S2"};
list.add(input);
Iterator<String> itr = list.iterator();
int index = 0;
while (itr.hasNext()) {
String item = itr.next();
assertEquals(input[index], item);
index++;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment