Search in sources :

Example 1 with ContextMapGenerator

use of org.contextmapper.dsl.generator.ContextMapGenerator in project context-mapper-dsl by ContextMapper.

the class StandaloneAPITest method canCallGenerator.

@Test
public void canCallGenerator() {
    // given
    StandaloneContextMapperAPI contextMapper = ContextMapperStandaloneSetup.getStandaloneAPI();
    CMLResource cml = contextMapper.loadCML("./integ-test-files/standalone/simple-context-map.cml");
    File expectedOutput = new File("./src-gen/simple-context-map_ContextMap.png");
    ensureFileDoesNotExist(expectedOutput);
    // when
    ContextMapGenerator generator = new ContextMapGenerator();
    generator.setContextMapFormats(ContextMapFormat.PNG);
    contextMapper.callGenerator(cml, generator);
    // then
    assertTrue(expectedOutput.exists());
}
Also used : CMLResource(org.contextmapper.dsl.cml.CMLResource) File(java.io.File) ContextMapGenerator(org.contextmapper.dsl.generator.ContextMapGenerator) Test(org.junit.jupiter.api.Test)

Example 2 with ContextMapGenerator

use of org.contextmapper.dsl.generator.ContextMapGenerator in project context-mapper-dsl by ContextMapper.

the class StandaloneAPITest method canGenerateIntoCustomDirectory.

@Test
public void canGenerateIntoCustomDirectory() {
    // given
    StandaloneContextMapperAPI contextMapper = ContextMapperStandaloneSetup.getStandaloneAPI();
    CMLResource cml = contextMapper.loadCML("./integ-test-files/standalone/simple-context-map.cml");
    File expectedOutput = new File("./out/simple-context-map_ContextMap.png");
    ensureFileDoesNotExist(expectedOutput);
    // when
    ContextMapGenerator generator = new ContextMapGenerator();
    generator.setContextMapFormats(ContextMapFormat.PNG);
    contextMapper.callGenerator(cml, generator, "./out");
    // then
    assertTrue(expectedOutput.exists());
}
Also used : CMLResource(org.contextmapper.dsl.cml.CMLResource) File(java.io.File) ContextMapGenerator(org.contextmapper.dsl.generator.ContextMapGenerator) Test(org.junit.jupiter.api.Test)

Aggregations

File (java.io.File)2 CMLResource (org.contextmapper.dsl.cml.CMLResource)2 ContextMapGenerator (org.contextmapper.dsl.generator.ContextMapGenerator)2 Test (org.junit.jupiter.api.Test)2