blob: 1768cd7ff7fa2cc1a367061e30a593ff944cfd1a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
package hu.bme.mit.inf.dslreasoner.application.FAMTest
import hu.bme.mit.inf.dslreasoner.application.execution.StandaloneScriptExecutor
import org.junit.Test
import org.junit.Assert
class StandaloneScriptExecutionTests {
private def runWithPath(String path, String expectedMessage) {
val message = StandaloneScriptExecutor.executeScript(path)
Assert.assertEquals(expectedMessage,message)
}
private def runWithPathCheckingPrefix(String path, String prefix) {
val message = StandaloneScriptExecutor.executeScript(path)
Assert.assertTrue(message.startsWith(prefix))
}
private def runWithPath(String path) {
runWithPath(path,null)
}
@Test
def void invalidExtension() {
runWithPath("invalid","Unsupported file extension: invalid")
}
@Test
def void nonexistingFile() {
runWithPathCheckingPrefix("invalid.vsconfig","Unable to load Configuration Script!")
}
@Test
def void errorousImports() {
runWithPath("configs/ErrorousImports.vsconfig",'''
The Configuration Script contains 4 errors:
Couldn't resolve reference to EPackage 'error'.
Couldn't resolve reference to PatternModel 'error'.
Couldn't resolve reference to EPackage 'functionalarchitecture'.
Couldn't resolve reference to PatternModel 'hu.bme.mit.inf.dslreasoner.domains.fam'.
''')
}
@Test
def void generateFAM() {
runWithPath("configs/generation.vsconfig")
}
}
|