static <T> Optional<T> lookupByNameAndType(CamelContext camelContext, String name, Class<T> type) {
        return Optional.ofNullable(ObjectHelper.isEmpty(name) ? null : name)
                .map(n -> EndpointHelper.isReferenceParameter(n)
                        ? EndpointHelper.resolveReferenceParameter(camelContext, n, type, false)
                        : camelContext.getRegistry().lookupByNameAndType(n, type));
    }
@Test
    void testLookupByNameAndTypeWithExistingObject() {
        String name = "ExistingObject";
        Object existingObject = new Object();
        when(camelContext.getRegistry()).thenReturn(mockRegistry);
        when(camelContext.getRegistry().lookupByNameAndType(name, Object.class))
                .thenReturn(existingObject);
        Optional<Object> object = DynamicRouterRecipientListHelper.lookupByNameAndType(camelContext, name, Object.class);
        Assertions.assertTrue(object.isPresent());
        Assertions.assertEquals(existingObject, object.get());
    }