package core.generator

import core.ServiceDescription
import org.scalatest.FlatSpec

class Play2RouteGeneratorSpec extends FlatSpec {

  it should "generate routes" in {
    val json = io.Source.fromURL(getClass.getResource("/api.json")).getLines.mkString("\n")
    val generator = Play2RouteGenerator(ServiceDescription(json))
    println(generator.generate())
  }

}

package core.generator

import core.ServiceDescription
import org.scalatest.FlatSpec

class Play2RouteGeneratorSpec extends FlatSpec {

  it should "generate routes" in {
    val r = getClass.getResource("/api.json")
    if (r == null) {
      sys.error("Could not find resource named api.json")
    }
    val json = io.Source.fromURL(r).getLines.mkString("\n")
    val generator = Play2RouteGenerator(ServiceDescription(json))
    println(generator.generate())
  }

}

Remove NPE if resource not found
Remove NPE if resource not found
