+/*\r
+ * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
package org.opendaylight.groupbasedpolicy.renderer.ofoverlay.statistics;\r
\r
import static org.mockito.Matchers.any;\r
-import static org.mockito.Matchers.anyMap;\r
-import static org.mockito.Matchers.anySet;\r
import static org.mockito.Matchers.anyString;\r
import static org.mockito.Mockito.doNothing;\r
import static org.mockito.Mockito.mock;\r
\r
import javax.ws.rs.core.MultivaluedMap;\r
\r
-import java.util.concurrent.ExecutorService;\r
import java.util.concurrent.ScheduledExecutorService;\r
\r
+import com.sun.jersey.api.client.ClientResponse;\r
import org.junit.Before;\r
import org.junit.Test;\r
+import org.mockito.Mockito;\r
import org.opendaylight.groupbasedpolicy.api.StatisticsManager;\r
\r
public class ReadGbpFlowCacheTaskTest {\r
\r
ReadGbpFlowCacheTask task;\r
+ private JsonRestClientResponse response;\r
\r
@Before\r
public void init() {\r
StatisticsManager statisticsManager = mock(StatisticsManager.class);\r
ScheduledExecutorService executor = mock(ScheduledExecutorService.class);\r
- JsonRestClientResponse response = mock(JsonRestClientResponse.class);\r
+ ClientResponse clientResponse = mock(ClientResponse.class);\r
+ response = mock(JsonRestClientResponse.class);\r
when(response.getJsonResponse()).thenReturn("[{\"one\":1, \"two\":2, \"three\":3}]");\r
when(response.getStatusCode()).thenReturn(200);\r
+ when(response.getClientResponse()).thenReturn(clientResponse);\r
SFlowRTConnection connection = mock(SFlowRTConnection.class);\r
- when(connection.get(anyString(), any(MultivaluedMap.class))).thenReturn(response);\r
+ when(connection.get(anyString(), Mockito.<MultivaluedMap<String, String>>any())).thenReturn(response);\r
when(connection.getExecutor()).thenReturn(executor);\r
doNothing().when(executor).execute(any(Runnable.class));\r
\r
\r
@Test\r
public void testRun() {\r
+ task.run();\r
+ }\r
+\r
+ @Test\r
+ public void testRun_response300() {\r
+ when(response.getStatusCode()).thenReturn(300);\r
+ task.run();\r
+ }\r
\r
+ @Test\r
+ public void testRun_response400() {\r
+ when(response.getStatusCode()).thenReturn(400);\r
task.run();\r
}\r
\r