java.lang.AssertionError: Request processing failed; nested exception is java.lang.IllegalStateException: No primary or default constructor found for class com.coco.domain.BoardVO
at org.junit.Assert.fail(Assert.java:89)
at com.coco.controller.BoardControllerTest.registerTest(BoardControllerTest.java:78)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:542)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:770)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
java.lang.IllegalStateException: No primary or default constructor found for class com.coco.domain.BoardVO
๊ธฐ๋ณธ ์์ฑ์๋ฅผ ์ฐพ์ ์ ์๋ค๋ ์๋ฌ๋ค.
๊ทธ๋์ VOํด๋์ค์ Lombok์ @NoArgsConstructor
๋ฅผ ์ด์ฉํ์ฌ ๊ธฐ๋ณธ ์์ฑ์๋ฅผ ๋ง๋ค์ด์คฌ๋๋,@Builder
์ ๋นจ๊ฐ ์ค์ด ์๊ธฐ๋ฉด์ The constructor BoardVO(Long, String, String, String, Date, Date) is undefined
๋ผ๋ ๋ฉ์ธ์ง๊ฐ ๋์๋ค.@Builder
๋ฅผ ์ฐ๋ฉด ๋ชจ๋ ์์๊ฐ ํฌํจ๋ ์์ฑ์๊ฐ ํจ๊ป ์์ฑ๋๋๋ฐ, ๊ฑฐ๊ธฐ๋ค๊ฐ @NoArgs.....
๋ฅผ ๋ถ์ด๋ฉด ๊ทธ ์์ฑ์๊ฐ ๊ธฐ๋ณธ ์์ฑ์๋ก ๋ฐ๋๋ค. ๋ฐ๋ผ์, ๋น๋์ ๊ผญ ํ์ํ ์์ฑ์๊ฐ ์ฌ๋ผ์ก๋ค๋ ์๋ฌ ๋ฉ์ธ์ง๋ฅผ ์ถ๋ ฅํ๋ ๊ฒ์ด๋ค.@AllArgsConstructor
๋ ํจ๊ป ๋ถ์ฌ์ฃผ๋ฉด ํด๊ฒฐ๋๋ค.
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BoardVO {
private Long bno;
private String title;
private String content;
private String writer;
private Date regdate;
private Date moddate;
}