Web アプリの junit テストを実行しようとしていますが、OutOfMemoryError が発生し続けます。コードのどこで起こっているかはわかっていますが、なぜそれをしているのかわかりません。
Survey survey = new Survey();
SurveyLayoutColumn column1 = new SurveyLayoutColumn();
column1.addAnswerSpace(new Answer());
SurveyLayoutColumn column2 = new SurveyLayoutColumn();
column2.addAnswerSpace(new Answer());
column2.addAnswerSpace(new Answer());
SurveyLayoutColumn column3 = new SurveyLayoutColumn();
column3.addAnswerSpace(new Answer());
survey.addLayoutColumn(column1);
survey.addLayoutColumn(column2);
survey.addLayoutColumn(column3);
survey.addQuestion(new Question());
survey.addQuestion(new Question());
survey.addQuestion(new Question());
survey.addQuestion(new Question());
Application app = new controllers.Application();
app.saveSurvey(survey);
long count = Survey.count();
assertEquals(count,0);
app.saveSurvey(surey) で発生し、そのメソッドのコードは次のとおりです
public static void saveSurvey(Survey survey) {
System.out.println("Survey title is: " + survey.title);
survey.published = true;
survey.save();
Map<String, Object> viewData = new HashMap<String, Object>();
viewData.put("status", "success");
JSONSerializer serializer = new JSONSerializer();
serializer
.include("status")
.exclude("*");
renderJSON(serializer.serialize(viewData));
}
なぜこれが起こっているのかについての助けは素晴らしいでしょう。
編集:ここにトレースがあります
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2882)
at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:100)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:390)
at java.lang.StringBuilder.append(StringBuilder.java:119)
at play.data.binding.Unbinder.unBind(Unbinder.java:106)
at play.data.binding.Unbinder.unBind(Unbinder.java:110)
at play.data.binding.Unbinder.unBind(Unbinder.java:63)
at play.data.binding.Unbinder.unBind(Unbinder.java:110)
at play.data.binding.Unbinder.unBind(Unbinder.java:110)
at play.data.binding.Unbinder.unBind(Unbinder.java:63)
at play.data.binding.Unbinder.unBind(Unbinder.java:110)
at play.data.binding.Unbinder.unBind(Unbinder.java:110)
at play.data.binding.Unbinder.unBind(Unbinder.java:63)
at play.data.binding.Unbinder.unBind(Unbinder.java:110)
at play.data.binding.Unbinder.unBind(Unbinder.java:110)
at play.data.binding.Unbinder.unBind(Unbinder.java:63)
at play.data.binding.Unbinder.unBind(Unbinder.java:110)
at play.data.binding.Unbinder.unBind(Unbinder.java:110)
at play.data.binding.Unbinder.unBind(Unbinder.java:63)
at play.data.binding.Unbinder.unBind(Unbinder.java:110)
at play.data.binding.Unbinder.unBind(Unbinder.java:110)
at play.data.binding.Unbinder.unBind(Unbinder.java:63)
at play.data.binding.Unbinder.unBind(Unbinder.java:110)
at play.data.binding.Unbinder.unBind(Unbinder.java:110)
at play.data.binding.Unbinder.unBind(Unbinder.java:63)
at play.data.binding.Unbinder.unBind(Unbinder.java:110)
at play.data.binding.Unbinder.unBind(Unbinder.java:110)
at play.data.binding.Unbinder.unBind(Unbinder.java:63)
at play.data.binding.Unbinder.unBind(Unbinder.java:110)
at play.data.binding.Unbinder.unBind(Unbinder.java:110)
at play.data.binding.Unbinder.unBind(Unbinder.java:63)
at play.data.binding.Unbinder.unBind(Unbinder.java:110)