val stream:AudioInputStream = AudioSystem.getAudioInputStream(new File("uploads/A1.wav"))
val audioFormat:AudioFormat = stream.getFormat();
val samplingRate = audioFormat.getSampleRate()
println("Sampling Rate: "+samplingRate)
javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input file
Test looks like...
"Valid POST Requests with Unsupported Sampling Rates should return failure" in {
// read in file contents
val file = new File("uploads/A1.wav")
//val bis = new BufferedInputStream(new java.io.FileInputStream(file))
//val bArray = Stream.continually(bis.read).takeWhile(-1 !=).map(_.toByte).toArray
val payload = MultipartFormData(Seq(
BodyPart(new File("uploads/test.wav"), "file", MediaTypes.`application/octet-stream`),
BodyPart("a", "category")))
// attach to request
//val httpEntity = HttpEntity(MediaTypes.`application/octet-stream`, bArray).asInstanceOf[HttpEntity.NonEmpty]
//val mfd = MultipartFormData(Seq(BodyPart(FormFile("file", httpEntity), "file"),
// BodyPart("a", "category")))
// send mock request
Post("/v1/sounds/analyse", payload) ~>
addHeader(Authorization(BasicHttpCredentials("bob", "123"))) ~>
sealRoute(phonemeRoutes) ~> check {
response.status should be equalTo BadRequest
responseAs[String] === "[Result: 0.43]"
}
}
This occurs when I run the test using "sbt test".
Could it be an encoding issue? Is the problem actually an sbt issue?
Anyone got any idea why this fails when running the tests?
Thanks!