view src/test/java/jp/ac/u_ryukyu/cr/ie/tatsuki/functionTest/PersonIdsTest.java @ 41:037731e99d6e

fit JungleCore 144
author one
date Mon, 17 Nov 2014 18:47:10 +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(false);
    LinkedList<String> filterIds = new LinkedList<String>();
    filterIds.add("r:9");
    Iterator<String> ids = jugrix.personIds("o:2", filterIds);

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

    filterIds.add("rde:3");
    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:322");
    ids = jugrix.personIds("o:2", filterIds);
    Assert.assertFalse(ids.hasNext());
    
    jugrix = new JuGrix(true);
    filterIds = new LinkedList<String>();
    filterIds.add("r:9");
    ids = jugrix.personIds("o:2", filterIds);

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

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

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

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