javaspring-bootjuniteclipselinkdbunit

Error running Junit test with DBUNIT on SpringBoot project


I have a Junit test, that when I run it I have this error:

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.

the entity

@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;


}

the dataset:

<AUTORISATION_BONANZA
        AUTORISATION_BONANZA_ID="1"
        POL="NOM"
        NOMOM="PRENOM"
        ORGANISATION_ID="1"
        />

and

@Entity
@NoArgsConstructor
@Data
public class Organisation implements Serializable {

    @Id
    @Column(name = "ORGANISATION_ID")
    private Long organisationId;
    private String code;



}

Solution

  • try to add this on the property file:

    org.dbunit.database.IMetadataHandler.implClassName=org.dbunit.ext.mysql.MySqlMetadataHandler