class EurekaServiceDiscovery extends AbstractServiceDiscovery {

    @Override
    public List<ServiceInstance> getInstances(String serviceName) throws NullPointerException {
        Application application = this.eurekaClient.getApplication(serviceName);

        if (application == null) {
            return emptyList();
        }

        List<InstanceInfo> infos = application.getInstances();
        List<ServiceInstance> instances = new ArrayList<>();
        for (InstanceInfo info : infos) {
            instances.add(buildServiceInstance(info));
        }
        return instances;
    }

}