view src/test/java/jp/ac/u_ryukyu/cr/ie/tatsuki/functionTest/PersonIdsTest.java @ 42:c036d36c33af

function refactor
author one
date Tue, 25 Nov 2014 11:57:17 +0900
parents 96dcbd8e2fcb
children 1bdd50e26fac
line wrap: on
line source

package jp.ac.u_ryukyu.cr.ie.tatsuki.functionTest;

import java.util.Iterator;
import java.util.LinkedList;

import jp.ac.u_ryukyu.cr.ie.tatsuki.bbs.JuGrix;
import junit.framework.Assert;

import org.junit.Test;


public class PersonIdsTest {

  @Test
  public void testPersonIds() {

    JuGrix jugrix = new JuGrix();
    LinkedList<String> filterIds = new LinkedList<String>();
    
    Iterator<String> ids = jugrix.personIds("o:2", filterIds);
    Assert.assertTrue(ids.hasNext());
    Assert.assertEquals(ids.next(), "p:1");
    Assert.assertTrue(ids.hasNext());
    Assert.assertEquals(ids.next(), "p:45");
    
    filterIds.add("r:9");
    ids = jugrix.personIds("o:2", filterIds);

    Assert.assertTrue(ids.hasNext());
    Assert.assertEquals(ids.next(), "p:45");
    Assert.assertTrue(ids.hasNext());
    Assert.assertEquals(ids.next(), "p:1");


    filterIds.add("rde:3");
    ids = jugrix.personIds("o:2", filterIds);

    ids.hasNext();
    Assert.assertEquals(ids.next(), "p:45");
    ids.hasNext();
    Assert.assertEquals(ids.next(), "p:1");



    filterIds.add("rde:322");
    ids = jugrix.personIds("o:2", filterIds);
    Assert.assertFalse(ids.hasNext());
    
   }
}