public static InstanceInfo takeFirst(Applications applications) {
        for (Application application : applications.getRegisteredApplications()) {
            if (!application.getInstances().isEmpty()) {
                return application.getInstances().get(0);
            }
        }
        return null;
    }
@Test
    public void testTakeFirstIfNotNullReturnFirstInstance() {
        Application application = createSingleInstanceApp("foo", "foo",
                InstanceInfo.ActionType.ADDED);
        Applications applications = createApplications(application);
        applications.addApplication(application);

        Assert.assertNull(EurekaEntityFunctions.takeFirst(new Applications()));
        Assert.assertEquals(application.getByInstanceId("foo"),
                EurekaEntityFunctions.takeFirst(applications));
    }