public static void copyInstances(Collection<InstanceInfo> instances, Applications result) {
        if (instances != null) {
            for (InstanceInfo instance : instances) {
                Application app = result.getRegisteredApplications(instance.getAppName());
                if (app == null) {
                    app = new Application(instance.getAppName());
                    result.addApplication(app);
                }
                app.addInstance(instance);
            }
        }
    }
@Test
    public void testCopyInstancesIfNotNullReturnCollectionOfInstanceInfo() {
        Application application = createSingleInstanceApp("foo", "foo",
                InstanceInfo.ActionType.ADDED);
        Assert.assertEquals(1,
                EurekaEntityFunctions.copyInstances(
                        new ArrayList<>(Arrays.asList(
                                application.getByInstanceId("foo"))),
                        InstanceInfo.ActionType.ADDED).size());
    }