Please help me to understand below groovy script function? : def writeTestCasePropertiesToFile = {
    //Get the test case properties as Properties object
    def properties =  context.testCase.properties.keySet().inject([:]){map, key ->  map[key] = context.testCase.getPropertyValue(key); map as Properties}  
    log.info properties
    assert properties instanceof Properties
    properties?.store(new File(propFileName).newWriter(), null) 
} 