Route53RaiderImpl implements Route53Raider { @Override public void updateTrafficPolicy(String trafficPolicyName, int version) { String r53TrafficPolicyId = getR53TrafficPolicyId(trafficPolicyName); String r53PolicyId = getR53PolicyId(r53TrafficPolicyId); UpdateTrafficPolicyInstanceRequest updateTrafficPolicyInstanceRequest = new UpdateTrafficPolicyInstanceRequest() .withId(r53PolicyId) .withTrafficPolicyId(r53TrafficPolicyId) .withTTL(20l) .withTrafficPolicyVersion(version); route53Delegator.getAmazonRoute53().updateTrafficPolicyInstance(updateTrafficPolicyInstanceRequest); } Route53RaiderImpl(); @Override List<HealthCheck> listHealthCheckers(); @Override List<HealthCheckObservation> getHealthCheckerStatus(String healthCheckerId); @Override HealthCheckStatus getSimpleHealthCheckerStatus(String healthCheckerId); @Override void updateTrafficPolicy(String trafficPolicyName, int version); @Override int getTrafficPolicyVersion(String trafficPolicyName); String getR53PolicyId(String policyId); @Override void updateHealthCheckRegions(String healthCheckId, List<String> regions); @Override List<String> getHealthCheckRegions(String healthCheckId); @Override void updateHealthCheckToDefaultRegions(String healthCheckId);  }
@Test public void testUpdateTrafficPolicyVersion() { UpdateTrafficPolicyInstanceResult updateTrafficPolicyInstanceResult = PowerMockito.mock(UpdateTrafficPolicyInstanceResult.class); Mockito.when(mockAmazonRoute53.updateTrafficPolicyInstance(Mockito.anyObject())).thenReturn(updateTrafficPolicyInstanceResult); ListTrafficPolicyInstancesResult listTrafficPolicyInstancesResult = PowerMockito.mock(ListTrafficPolicyInstancesResult.class); Mockito.when(mockAmazonRoute53.listTrafficPolicyInstances()).thenReturn(listTrafficPolicyInstancesResult); TrafficPolicyInstance trafficPolicyInstance = new TrafficPolicyInstance(); trafficPolicyInstance.setName("testPolicy"); trafficPolicyInstance.setTrafficPolicyVersion(1); trafficPolicyInstance.setTrafficPolicyId("abc"); trafficPolicyInstance.setId("abc"); ListTrafficPoliciesResult listTrafficPoliciesResult = PowerMockito.mock(ListTrafficPoliciesResult.class); Mockito.when(mockAmazonRoute53.listTrafficPolicies()).thenReturn(listTrafficPoliciesResult); TrafficPolicySummary trafficPolicySummary = new TrafficPolicySummary(); trafficPolicySummary.setName("testPolicy"); trafficPolicySummary.setId("abc"); Mockito.when(listTrafficPoliciesResult.getTrafficPolicySummaries()).thenReturn(Arrays.asList(trafficPolicySummary)); Mockito.when(listTrafficPolicyInstancesResult.getTrafficPolicyInstances()).thenReturn(Arrays.asList(trafficPolicyInstance)); route53RaiderUnderTest.updateTrafficPolicy("testPolicy", 2); }