[Seasar-user:21788] S2Unit4 テストエラーの件

[E-MAIL ADDRESS DELETED] [E-MAIL ADDRESS DELETED]
2014年 1月 30日 (木) 22:49:33 JST


いつも大変お世話になっております。

阿形と申します。




現在、S2Unit4を使用してテストを行っております。

ですが中々テストが通らず苦心しています。

お手数おかけしますが、見落としている箇所

見直したほうが良い箇所がありましたら教えて

いただきたく、よろしくお願い致します。




トレースのコピー




java.lang.AssertionError: OUTPUT expected:<Expected:HOZENNO, BUMONCODE, SETSUBICODE, HASSEINICHIJI, SYUFUKUBI, SYAINCODE
{26, 0001, 000001, 14-01-10, 14-01-10, 0297}
{28, 0001, 000003, 14-01-14, 14-01-14, 0297}
{29, 0001, 000001, 14-01-14, 14-01-14, 0297}
{36, 0001, 000003, 14-01-15, 14-01-15, 0297}
{19, 0001, 000001, 14-01-02, 14-01-02, 0295}
{33, 0001, 000001, 14-01-15, 14-01-15, 0297}
{38, 0001, 000001, 14-01-24, 14-01-24, 0297}
{31, 0001, 000003, 14-01-15, 14-01-15, 0297}
{32, 0001, 000001, 14-01-15, 14-01-15, 0297}
{20, 0002, 000001, 14-01-02, 14-01-02, 0296}
{21, 0001, 000001, 14-01-06, 14-01-06, 0297}
{22, 0001, 000001, 14-01-07, 14-01-07, 0295}
{23, 0001, 000001, 14-01-06, 14-01-06, 0297}
{24, 0001, 000001, 14-01-14, 14-01-14, 0297}
{25, 0001, 000001, 14-01-10, 14-01-10, 0297}
{27, 0001, 000001, 14-01-14, 14-01-14, 0297}
{30, 0001, 000001, 14-01-14, 14-01-14, 0297}
{34, 0001, 000001, 14-01-14, 14-01-14, 0297}
{35, 0001, 000003, 14-01-15, 14-01-15, 0297}
{37, 0001, 000001, 14-01-14, 14-01-14, 0297}
{39, 0001, 000001, 14-01-20, 14-01-20, 0297}
{40, 0001, 000001, 14-01-20, 14-01-20, 0297}
{41, 0001, 000001, 14-01-20, 14-01-20, 0297}
{18, 0001, 000001, 14-01-02, 14-01-02, 0295}
> but was:<[Lequipment.system.entity.Emtbl;@25592bea>
 at org.junit.Assert.fail(Assert.java:74)
 at org.junit.Assert.failNotEquals(Assert.java:448)
 at org.junit.Assert.assertEquals(Assert.java:102)
 at equipment.system.web.emtbl.EmtblListPageTest.testDoOnceSearch(EmtblListPageTest.java:72)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:601)
 at org.seasar.framework.unit.S2TestMethodRunner.executeMethodBody(S2TestMethodRunner.java:672)
 at org.seasar.framework.unit.S2TestMethodRunner.executeMethod(S2TestMethodRunner.java:647)
 at org.seasar.framework.unit.S2TestMethodRunner.runTest(S2TestMethodRunner.java:612)
 at org.seasar.framework.unit.S2TestMethodRunner.runMethod(S2TestMethodRunner.java:250)
 at org.seasar.framework.unit.S2TestMethodRunner.run(S2TestMethodRunner.java:166)
 at org.seasar.framework.unit.S2TestClassMethodsRunner.invokeTestMethod(S2TestClassMethodsRunner.java:227)
 at org.seasar.framework.unit.S2TestClassMethodsRunner.run(S2TestClassMethodsRunner.java:89)
 at org.seasar.framework.unit.S2TestClassRunner.run(S2TestClassRunner.java:67)
 at org.seasar.framework.unit.Seasar2.run(Seasar2.java:179)
 at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
 at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)




テストコード




package equipment.system.web.emtbl;




import static org.junit.Assert.*;




import java.text.DateFormat;
import java.text.ParseException;
import java.util.Date;




import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.seasar.extension.dataset.DataSet;
import org.seasar.framework.container.annotation.tiger.Binding;
import org.seasar.framework.unit.DataAccessor;
import org.seasar.framework.unit.Seasar2;
import org.seasar.framework.unit.TestContext;




import equipment.system.dao.EmtblDao;
import equipment.system.dto.EmtblDto;
import equipment.system.entity.Emtbl;




@RunWith(Seasar2.class)
public class EmtblListPageTest {

 private TestContext  ctx;
  
 
 @Binding
 private EmtblDao  dao;


 private DataAccessor accessor;




 public EmtblListPageTest() {
   
 }
 
 @Test
 public void testDoOnceSearch() {
 
  // テスト対象の実行
  Date date = null;
  try {
   date = DateFormat.getDateInstance().parse("2014/01/01");
  } catch (ParseException e) 
   e.printStackTrace();
  }


  EmtblDto[] resultDto = dao.selectByIdKenmei("0001", "1", "0297", "000001", date);
  
  // 返値の検証
  assertEquals("RESULT", 2,  resultDto.length); 


  Emtbl[] resultList = dao.selectAll();
  DataSet expected = ctx.getExpected();
  assertEquals("OUTPUT", expected, resultList);  ←ここでエラーが出ています





 }

}
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
URL: <http://ml.seasar.org/archives/seasar-user/attachments/20140130/8d8b5dbb/attachment.html>


Seasar-user メーリングリストの案内