package com.behase.relumin.model;

import static org.junit.Assert.*;

public class ClusterTest {

}

@@ -39,62 +39,1823 @@
 ort 
-static org.junit.Assert.*;%0A%0Apublic class ClusterTest %7B%0A
+com.google.common.collect.ImmutableMap;%0Aimport com.google.common.collect.Lists;%0Aimport com.google.common.collect.Sets;%0Aimport static org.hamcrest.Matchers.is;%0Aimport static org.hamcrest.Matchers.notNullValue;%0Aimport static org.hamcrest.Matchers.nullValue;%0Aimport static org.junit.Assert.assertThat;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Apublic class ClusterTest %7B%0A%09private Cluster cluster;%0A%0A%09@Before%0A%09public void init() %7B%0A%09%09cluster = new Cluster();%0A%09%7D%0A%0A%09@Test%0A%09public void getNodeByHostAndPort() %7B%0A%09%09cluster.setNodes(Lists.newArrayList(%0A%09%09%09%09ClusterNode.builder().hostAndPort(%22localhost:10000%22).build(),%0A%09%09%09%09ClusterNode.builder().hostAndPort(%22localhost:10001%22).build()%0A%09%09));%0A%0A%09%09assertThat(cluster.getNodeByHostAndPort(%22localhost:10000%22), is(notNullValue()));%0A%09%09assertThat(cluster.getNodeByHostAndPort(%22localhost:10003%22), is(nullValue()));%0A%09%7D%0A%0A%09@Test%0A%09public void getNodeByNodeId() %7B%0A%09%09cluster.setNodes(Lists.newArrayList(%0A%09%09%09%09ClusterNode.builder().nodeId(%22nodeId1%22).build(),%0A%09%09%09%09ClusterNode.builder().nodeId(%22nodeId2%22).build()%0A%09%09));%0A%0A%09%09assertThat(cluster.getNodeByNodeId(%22nodeId1%22), is(notNullValue()));%0A%09%09assertThat(cluster.getNodeByNodeId(%22nodeId3%22), is(nullValue()));%0A%09%7D%0A%0A%09@Test%0A%09public void getStatus() %7B%0A%09%09cluster.setStatus(%22status%22);%0A%09%09assertThat(cluster.getStatus(), is(%22status%22));%0A%0A%09%09cluster.setStatus(null);%0A%09%09cluster.setInfo(ImmutableMap.of(%22cluster_state%22, %22fail%22));%0A%09%09assertThat(cluster.getStatus(), is(%22fail%22));%0A%0A%09%09cluster.setStatus(null);%0A%09%09cluster.setInfo(ImmutableMap.of());%0A%09%09cluster.setNodes(Lists.newArrayList(%0A%09%09%09%09ClusterNode.builder().flags(Sets.newHashSet(%22fail%22)).build()%0A%09%09));%0A%09%09assertThat(cluster.getStatus(), is(%22warn%22));%0A%0A%09%09cluster.setStatus(null);%0A%09%09cluster.setInfo(ImmutableMap.of());%0A%09%09cluster.setNodes(Lists.newArrayList(%0A%09%09));%0A%09%09assertThat(cluster.getStatus(), is(%22ok%22));%0A%09%7D
 %0A%7D%0A

add test