public static Map<String, Application> toApplicationMap(List<InstanceInfo> instances) {
        Map<String, Application> applicationMap = new HashMap<String, Application>();
        for (InstanceInfo instance : instances) {
            String appName = instance.getAppName();
            Application application = applicationMap.get(appName);
            if (application == null) {
                applicationMap.put(appName, application = new Application(appName));
            }
            application.addInstance(instance);
        }
        return applicationMap;
    }
@Test
    public void testToApplicationMapIfNotNullReturnMapOfApplication() {
        Application application = createSingleInstanceApp("foo", "foo",
                InstanceInfo.ActionType.ADDED);
        Assert.assertEquals(1, EurekaEntityFunctions.toApplicationMap(
                new ArrayList<>(Arrays.asList(
                        application.getByInstanceId("foo")))).size());
    }