You are on the right track. The arguments to addGraph() are as follows:
name - the name of the graph which would be test in your example command
properties - a Java Properties object representing the connection and configuration of the virtual graph. You can use Properties.load() to load the contents of your file.
mappings - a set of R2RML mappings in the form of a set of RDF triples. Perhaps you can use the Rio.parse() function here to read the contents of test.ttl. This will return a Model which will be accepted as an argument.