public class ClusterTargetServerProvider extends TestCase {
public void test() throws Exception {
Server server1 = new Server(new URL("http://127.0.0.1:8080/woj-server"));
Server server2 = new Server(new URL("http://127.0.0.1:8080/woj-server2"));
Server server3 = new Server(new URL("http://127.0.0.1:8080/"));
ClusterMasterTargetServerProvider tsp = new ClusterMasterTargetServerProvider(new WOJCluster(Arrays.asList(new Server[] {
server1,
server2,
server3})));
assertTrue(server1 == tsp.getFirstTargetServer());
assertTrue(tsp.hasNext());
assertTrue(server1 == tsp.getNextTargetServer());
assertTrue(tsp.hasNext());
assertTrue(server2 == tsp.getNextTargetServer());
assertTrue(tsp.hasNext());
assertTrue(server3 == tsp.getNextTargetServer());
assertFalse(tsp.hasNext());
}