@@ -0,0 +1,1983 @@
+package enmasse.rc.admin;%0A%0Aimport com.openshift.internal.restclient.model.ReplicationController;%0Aimport com.openshift.restclient.model.IReplicationController;%0Aimport enmasse.rc.generator.ConfigGenerator;%0Aimport enmasse.rc.model.BrokerProperties;%0Aimport enmasse.rc.model.Destination;%0Aimport enmasse.rc.openshift.OpenshiftClient;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.mockito.ArgumentCaptor;%0A%0Aimport java.util.Collections;%0Aimport java.util.List;%0A%0Aimport static org.hamcrest.CoreMatchers.is;%0Aimport static org.junit.Assert.assertThat;%0Aimport static org.mockito.Mockito.*;%0A%0A/**%0A * @author lulf%0A */%0Apublic class BrokerManagerTest %7B%0A    private OpenshiftClient mockClient;%0A    private BrokerManager manager;%0A%0A    @Before%0A    public void setUp() %7B%0A        mockClient = mock(OpenshiftClient.class);%0A        manager = new BrokerManager(mockClient, new ConfigGenerator(null, new BrokerProperties.Builder().build()));%0A    %7D%0A%0A    @Test%0A    public void testModifiedBrokerDoesNotResetReplicaCount() %7B%0A        // Create simple queue and capture generated replication controller%0A        ArgumentCaptor%3CIReplicationController%3E arg = ArgumentCaptor.forClass(IReplicationController.class);%0A%0A        Destination queue = new Destination(%22myqueue%22, true, false);%0A        manager.destinationsUpdated(Collections.singletonList(queue));%0A        verify(mockClient).createBroker(arg.capture());%0A%0A        IReplicationController controller = arg.getValue();%0A        when(mockClient.getBroker(%22controller-myqueue%22)).thenReturn(controller);%0A        when(mockClient.listBrokers()).thenReturn(Collections.singletonList(controller));%0A%0A        // Modify replicas and update controller%0A        controller.setReplicas(3);%0A        Destination modifiedQueue = new Destination(%22myqueue%22, true, true);%0A        manager.destinationsUpdated(Collections.singletonList(modifiedQueue));%0A%0A        verify(mockClient).updateBroker(arg.capture());%0A        assertThat(arg.getValue().getReplicas(), is(3));%0A    %7D%0A%7D%0A

Add test case ensuring that replica count is not modified