package chat;

import java.util.Vector;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

public class TestTextChat extends TestCase {
	Chatter bob ;
	Chatter joe ;
	GestTopics gt;
	ChatRoom cr;	
	
	public TestTextChat(String string) {
		super(string);
	}
	
	public void testCreate () {
		
		Vector<String> res = new Vector<String>();
		
		gt.creerTopic("java");
		res.add("java");
		assertEquals(res,gt.listerTopics());
		gt.creerTopic("UML");
		assertTrue(gt.listerTopics().contains("UML"));		
	}
    @Override
	protected void setUp() { 
    	 bob = new TextChatter ("Bob");
    	 joe = new TextChatter ("Joe");
    	 gt = new TextGestTopics();
    }
    
    public static Test suite() { 
		TestSuite suite= new TestSuite();
		suite.addTest(new TestTextChat("testCreate"));
		suite.addTest(new TestTextChat("testJoinNotExists"));
		suite.addTest(new TestTextChat("testJoinExists"));
		return suite;
    }

    
	public static void main(String[] args) {
		
	}
	
	
	public void testJoinNotExists() {
		gt.creerTopic("UML");
		cr = gt.rejoindreTopic("jeux");
		assertTrue(cr==null);
	}
	
	public void testJoinExists() {
		gt.creerTopic("UML");
		cr = gt.rejoindreTopic("UML");
		assertTrue(cr!=null);
	}
//	cr.rejoindre(bob);
//		cr.poster("Je suis seul ou quoi ?",bob);
//		cr.rejoindre(joe);
//		cr.poster("Tiens, salut Joe !",bob);
//		cr.poster("Toi aussi tu chat sur les forums de jeux pendant les TP, Bob?",joe);
//	}
}
