public static String substVars(String val, PropertyContainer pc1) throws ScanException {
        return substVars(val, pc1, null);
    }
@Test
    public void detectCircularReferences5() throws ScanException {
        context.putProperty("A", "${B} and ${C}");
        context.putProperty("B", "${B1}");
        context.putProperty("B1", "B1-value");
        context.putProperty("C", "${C1}");
        context.putProperty("C1", "here's the loop: ${A}");

        
        Exception e = assertThrows(IllegalArgumentException.class, () -> {
            OptionHelper.substVars("${A}", context);
        });
        String expectedMessage = CIRCULAR_VARIABLE_REFERENCE_DETECTED+"${A} --> ${C} --> ${C1} --> ${A}]";
        assertEquals(expectedMessage, e.getMessage());
    }