}
});
managementClient = ManagementService.create(config);
TestResponseFilter testFilter1 = new TestResponseFilter("filter1c");
TestResponseFilter testFilter2 = new TestResponseFilter("filter2c");
ManagementClient filteredService = managementClient.withResponseFilterFirst(testFilter1);
filteredService = filteredService.withResponseFilterFirst(testFilter2);
// Executing operation on the filtered service should execute the filter
AffinityGroupListResponse response = filteredService.getAffinityGroupsOperations().list();
Assert.assertEquals(200, response.getStatusCode());
Assert.assertEquals(1, testFilter1.getCalled());
Assert.assertEquals(0, testFilter2.getCalled());
// Make sure the filter executes twice
response = filteredService.getAffinityGroupsOperations().list();
Assert.assertEquals(200, response.getStatusCode());
Assert.assertEquals(2, testFilter1.getCalled());
Assert.assertEquals(0, testFilter2.getCalled());
}