【问题标题】:error NoSuchColumnException DbUnit错误 NoSuchColumnException DbUnit
【发布时间】:2015-08-10 13:12:29
【问题描述】:

我有一个带有 JSON 列的表,当我使用数据集运行测试时。

org.dbunit.dataset.NoSuchColumnException: hero.JSON - (Non-uppercase
input column: json) in ColumnNameToIndexes cache map. Note that the map's
column names are NOT case sensitive.

我的数据集:

 <?xml version="1.0" encoding="UTF-8"?>
 <dataset>

   <hero id='000580548' json='{"id" : 1,"name" : "mySuperHero"}'/>
   <hero_profile id='000580548-mySuperHero' json='{"habilities": [], "stars" : 7}'/>
</dataset>

Obs:我的表已经存在于数据库中。

【问题讨论】:

    标签: junit dbunit


    【解决方案1】:

    默认情况下,DbUnit 不理解 json 字段设置。 要么在测试中省略它,要么为 DbUnit 编写自定义扩展

    【讨论】:

      【解决方案2】:

      你可以用诡计做到这一点:

      <hero 
      id="000580548" 
      json="{&quot;id&quot; : 1,&quot;name&quot; : &quot;mySuperHero&quot;}"
      />
      

      这对我们有用。

      【讨论】:

        猜你喜欢
        • 2018-11-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-05-07
        • 1970-01-01
        • 2015-12-04
        • 2015-05-06
        相关资源
        最近更新 更多