diff --git a/.gitignore b/.gitignore
index 32858aad3c..c1785e61a0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,12 +1,7 @@
*.class
+*.iml
-# Mobile Tools for Java (J2ME)
-.mtj.tmp/
+.idea/
+target/
-# Package Files #
-*.jar
-*.war
-*.ear
-
-# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000000..470bfc2b8f
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,54 @@
+
+
+ 4.0.0
+
+ eu.codearte.contract-keeper
+ contract-keeper
+ 1.0.0-SNAPSHOT
+
+
+ 2.3.7
+
+
+
+
+ org.codehaus.groovy
+ groovy-all
+ ${groovy.version}
+
+
+
+ junit
+ junit
+ 4.11
+ test
+
+
+ com.jayway.restassured
+ rest-assured
+ 2.4.0
+ test
+
+
+
+
+
+
+
+ org.codehaus.gmavenplus
+ gmavenplus-plugin
+ 1.2
+
+
+
+ compile
+ testCompile
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/groovy/eu/coderate/ck/Generator.groovy b/src/main/groovy/eu/coderate/ck/Generator.groovy
new file mode 100644
index 0000000000..2eb6e37959
--- /dev/null
+++ b/src/main/groovy/eu/coderate/ck/Generator.groovy
@@ -0,0 +1,16 @@
+package eu.coderate.ck
+
+import static eu.coderate.ck.builder.ClassBuilder.createClass
+import static eu.coderate.ck.builder.MethodBuilder.createVoidMethod
+
+class Generator {
+
+ public static void main(String[] args) {
+ print createClass('MyTest', 'io.test')
+ .addImport('org.junit.Test')
+ .addStaticImport('org.hamcrest.CoreMatchers.*')
+ .addStaticImport('com.jayway.restassured.RestAssured.*')
+ .addMethod(createVoidMethod('shouldInvokeService'))
+ .build()
+ }
+}
\ No newline at end of file
diff --git a/src/main/groovy/eu/coderate/ck/builder/BlockBuilder.groovy b/src/main/groovy/eu/coderate/ck/builder/BlockBuilder.groovy
new file mode 100644
index 0000000000..dd8b4114e0
--- /dev/null
+++ b/src/main/groovy/eu/coderate/ck/builder/BlockBuilder.groovy
@@ -0,0 +1,59 @@
+package eu.coderate.ck.builder
+
+import groovy.transform.PackageScope
+
+/**
+ * @author Jakub Kubrynski
+ */
+@PackageScope
+class BlockBuilder {
+
+ private final StringBuilder builder
+ private final String spacer
+ private int indents
+
+ BlockBuilder(String spacer) {
+ this.spacer = spacer
+ builder = new StringBuilder()
+ }
+
+ BlockBuilder startBlock() {
+ indents++
+ return this
+ }
+
+ BlockBuilder endBlock() {
+ indents--
+ return this
+ }
+
+ BlockBuilder addLine(String line) {
+ addIndentation()
+ builder << "$line\n"
+ return this
+ }
+
+ BlockBuilder addEmptyLine() {
+ builder << '\n'
+ return this
+ }
+
+ void addIndentation() {
+ indents.times {
+ builder << spacer
+ }
+ }
+
+ BlockBuilder addBlock(MethodBuilder methodBuilder) {
+ startBlock()
+ methodBuilder.appendTo(this)
+ endBlock()
+ addEmptyLine()
+ return this
+ }
+
+ @Override
+ String toString() {
+ return builder.toString()
+ }
+}
diff --git a/src/main/groovy/eu/coderate/ck/builder/ClassBuilder.groovy b/src/main/groovy/eu/coderate/ck/builder/ClassBuilder.groovy
new file mode 100644
index 0000000000..1d53705e21
--- /dev/null
+++ b/src/main/groovy/eu/coderate/ck/builder/ClassBuilder.groovy
@@ -0,0 +1,61 @@
+package eu.coderate.ck.builder
+
+/**
+ * @author Jakub Kubrynski
+ */
+class ClassBuilder {
+
+ private final String className
+ private final String packageName
+ private final List imports = []
+ private final List staticImports = []
+ private final List methods = []
+
+ private ClassBuilder(String className, String packageName) {
+ this.packageName = packageName
+ this.className = className
+ }
+
+ static ClassBuilder createClass(String className, String packageName) {
+ return new ClassBuilder(className, packageName)
+ }
+
+ ClassBuilder addImport(String importToAdd) {
+ imports << importToAdd
+ return this
+ }
+
+ ClassBuilder addStaticImport(String importToAdd) {
+ staticImports << importToAdd
+ return this
+ }
+
+ ClassBuilder addMethod(MethodBuilder methodBuilder) {
+ methods << methodBuilder
+ return this
+ }
+
+ String build() {
+ BlockBuilder clazz = new BlockBuilder(" ")
+ .addLine("package $packageName;")
+ .addEmptyLine()
+ imports.sort().each {
+ clazz.addLine("import $it;")
+ }
+ clazz.addEmptyLine()
+ staticImports.sort().each {
+ clazz.addLine("static import $it;")
+ }
+ clazz.addEmptyLine()
+
+ clazz.addLine("public class $className {")
+ clazz.addEmptyLine()
+
+ methods.each {
+ clazz.addBlock(it)
+ }
+
+ clazz.addLine('}')
+ clazz.toString()
+ }
+}
diff --git a/src/main/groovy/eu/coderate/ck/builder/MethodBuilder.groovy b/src/main/groovy/eu/coderate/ck/builder/MethodBuilder.groovy
new file mode 100644
index 0000000000..53d8e3e987
--- /dev/null
+++ b/src/main/groovy/eu/coderate/ck/builder/MethodBuilder.groovy
@@ -0,0 +1,25 @@
+package eu.coderate.ck.builder
+
+/**
+ * @author Jakub Kubrynski
+ */
+class MethodBuilder {
+
+ private final String methodName
+ private final String returnType
+
+ private MethodBuilder(String returnType, String methodName) {
+ this.returnType = returnType
+ this.methodName = methodName
+ }
+
+ static MethodBuilder createVoidMethod(String methodName) {
+ return new MethodBuilder("void", methodName)
+ }
+
+ void appendTo(BlockBuilder blockBuilder) {
+ blockBuilder.addLine('@Test')
+ blockBuilder.addLine("public $returnType $methodName {")
+ .addLine('}')
+ }
+}