fix and tests for #503

This commit is contained in:
Tony Tam
2015-03-16 22:10:35 -07:00
parent 46d1950fbd
commit c215d8ab91
3 changed files with 35 additions and 12 deletions

View File

@@ -14,7 +14,6 @@ import scala.collection.JavaConverters._
@RunWith(classOf[JUnitRunner])
class JavaModelTest extends FlatSpec with Matchers {
it should "convert a simple java model" in {
val model = new ModelImpl()
.description("a sample model")
@@ -322,4 +321,18 @@ class JavaModelTest extends FlatSpec with Matchers {
vars.get(0).required should equal (true)
vars.get(0).isNotContainer should equal (true)
}
it should "convert hyphens per issue 503" in {
val model = new ModelImpl()
.description("a sample model")
.property("created-at", new DateTimeProperty())
val codegen = new JavaClientCodegen()
val cm = codegen.fromModel("sample", model)
val vars = cm.vars
vars.get(0).baseName should be("created-at")
vars.get(0).getter should be ("getCreated_at")
vars.get(0).setter should be ("setCreated_at")
vars.get(0).name should be ("created_at")
}
}