@Test
public void testOriginResolutionWithAllPlugins() {

    //given
    EC2Plugin ec2Plugin = Mockito.mock(EC2Plugin.class);
    ECSPlugin ecsPlugin = Mockito.mock(ECSPlugin.class);
    ElasticBeanstalkPlugin ebPlugin = Mockito.mock(ElasticBeanstalkPlugin.class);
    EKSPlugin eksPlugin = Mockito.mock(EKSPlugin.class);
    List<Plugin> plugins = new ArrayList<>();
    plugins.add(ec2Plugin);
    plugins.add(ecsPlugin);
    plugins.add(ebPlugin);
    plugins.add(eksPlugin);
    List<String> origins = new ArrayList<>();
    origins.add(EC2Plugin.ORIGIN);
    origins.add(ECSPlugin.ORIGIN);
    origins.add(ElasticBeanstalkPlugin.ORIGIN);
    origins.add(EKSPlugin.ORIGIN);
    Map<String, Object> runtimeContext = new HashMap<>();
    runtimeContext.put("key", "value");
    for (int i = 0; i < 4; i++) {
        Mockito.doReturn(true).when(plugins.get(i)).isEnabled();
        Mockito.doReturn(runtimeContext).when(plugins.get(i)).getRuntimeContext();
        Mockito.doReturn("serviceName").when(plugins.get(i)).getServiceName();
        Mockito.doReturn(origins.get(i)).when(plugins.get(i)).getOrigin();
    }
    AWSXRayRecorder recorder = AWSXRayRecorderBuilder.standard()
                                                     .withPlugin(ec2Plugin)
                                                     .withPlugin(ecsPlugin)
                                                     .withPlugin(ebPlugin)
                                                     .withPlugin(eksPlugin)
                                                     .build();
    // when
    Assert.assertEquals(ElasticBeanstalkPlugin.ORIGIN, recorder.getOrigin());
}