错误 运行 在 SpringBoot 项目上使用 DBUNIT 进行 Junit 测试
Error running Junit test with DBUNIT on SpringBoot project
我有一个 Junit 测试,当我 运行 它时我有这个错误:
org.dbunit.dataset.NoSuchColumnException: AUTORISATION_BONANZA.ORGANISATION_ID - (Non-uppercase input column: ORGANISATION_ID) in ColumnNameToIndexes cache map. Note that the map's column names are NOT case sensitive.
实体
@Entity
@NoArgsConstructor
@Data
public class AutorisationBonanza implements Serializable {
@Id
@Column(name = "AUTORISATION_BONANZA_ID")
private Long autorisationBonanzaId;
private String pol;
private String nomom;
@ManyToOne
@JoinColumn(name = "ORGANISATION_ID")
private Organisation organisation;
}
数据集:
<AUTORISATION_BONANZA
AUTORISATION_BONANZA_ID="1"
POL="NOM"
NOMOM="PRENOM"
ORGANISATION_ID="1"
/>
和
@Entity
@NoArgsConstructor
@Data
public class Organisation implements Serializable {
@Id
@Column(name = "ORGANISATION_ID")
private Long organisationId;
private String code;
}
尝试在 属性 文件中添加:
org.dbunit.database.IMetadataHandler.implClassName=org.dbunit.ext.mysql.MySqlMetadataHandler
我有一个 Junit 测试,当我 运行 它时我有这个错误:
org.dbunit.dataset.NoSuchColumnException: AUTORISATION_BONANZA.ORGANISATION_ID - (Non-uppercase input column: ORGANISATION_ID) in ColumnNameToIndexes cache map. Note that the map's column names are NOT case sensitive.
实体
@Entity
@NoArgsConstructor
@Data
public class AutorisationBonanza implements Serializable {
@Id
@Column(name = "AUTORISATION_BONANZA_ID")
private Long autorisationBonanzaId;
private String pol;
private String nomom;
@ManyToOne
@JoinColumn(name = "ORGANISATION_ID")
private Organisation organisation;
}
数据集:
<AUTORISATION_BONANZA
AUTORISATION_BONANZA_ID="1"
POL="NOM"
NOMOM="PRENOM"
ORGANISATION_ID="1"
/>
和
@Entity
@NoArgsConstructor
@Data
public class Organisation implements Serializable {
@Id
@Column(name = "ORGANISATION_ID")
private Long organisationId;
private String code;
}
尝试在 属性 文件中添加:
org.dbunit.database.IMetadataHandler.implClassName=org.dbunit.ext.mysql.MySqlMetadataHandler