https://www.playframework.com/documentation/2.6.x/api/java/play/db/Database.html 문서에는 있는데.


play.db.Database를 import하려고 하려면 에러가 난다.


import play.db._



libraryDependencies += jdbc 를 추가하면 된다. 기본적으로 추가가 되어 있지 않다.. 

Posted by '김용환'
,



sbt는 스칼라 컴파일 툴이다.

의존성을 추가할 때 

%%를 사용하면 버전을 artifact 뒤에 추가한다. 스칼라는 아직 하위 호환성보다는 잘 만들어질 언어를 지향하기 때문인데..


그러나 자바 라이브러리를 쓰기 위해 %%를 하면 에러가 발생한다. 그 것은 자바는 버전 별로 라이브러리를 만들지 않기 때문이다. 



sbt.librarymanagement.ResolveException: unresolved dependency: org.apache.phoenix#phoenix-core_2.11;4.11.0-HBase-1.2: not found




scala lib은 %%를

java lib은 %를 사용하는 것에 익숙해질 필요가 있다. ㅠ(맨날 틀림.)

libraryDependencies ++= Seq(guice,
"org.scalatestplus.play" %% "scalatestplus-play" % "3.1.1" % "test",
"org.apache.phoenix" % "phoenix-core" % "4.11.0-HBase-1.2")


Posted by '김용환'
,


요즘 뜨고 있는 java REST 테스트 관련 라이브러리 중에 https://github.com/rest-assured/rest-assured이 있다.


자바에서는 구조적으로 REST 호출과 결과 테스트(특히 json)를 하려면 지저분한 코드(map, list)를 써야 한다.

rest-assured는 이를 쉽게 테스트해줄 수 있다. 



http://localhost:8080/lotto


{
"lotto":{
 "lottoId":5,
 "winning-numbers":[2,45,34,23,7,5,3],
 "winners":[{
   "winnerId":23,
   "numbers":[2,45,34,23,3,5]
 },{
   "winnerId":54,
   "numbers":[52,3,12,11,18,22]
 }]
}
}




테스트 코드는 다음과 같다. 써봐야 할듯 ㅎㅎ


get("/lotto").then().body("lotto.lottoId", equalTo(5));



get("/lotto").then().body("lotto.winners.winnerId", hasItems(23, 54));




Posted by '김용환'
,


intellij에서 sbt 컴파일 중에 에러가 발생했다. 


[error] java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: sbt/internal/librarymanagement/GetClassifiersModule



최신 버전으로 intellij를 업데이트하면 문제가 해결된다.

Posted by '김용환'
,