Error when starting JUnit with deprecated version of POI

Introduction

In a certain project, the unit test class kept throwing errors, so I investigated the cause. It is a memo of the investigation process at that time.

The error that was occurring

SLF4J: Failed toString() invocation on an object of type [org.apache.poi.hssf.usermodel.HSSFRow]
java.lang.AssertionError: hashCode not designed
    at org.apache.poi.hssf.usermodel.HSSFRow.hashCode(HSSFRow.java:704)
    at java.lang.Object.toString(Object.java:236)
    :
    :

Due to the above error, the output of the debug log failed. (I was still able to run the test class)

Let's see where the error occurred

Take a look at HSSFRow.java where the error is occurring

702: @Override
703: public int hashCode() {
704:     assert false : "hashCode not designed";
705:     return 42; // any arbitrary constant will do
706: }

Apparently, it seems that the implementation is such that an AssertionError occurs when the hashCode method is called.

I checked the version of the library

I was a little worried and decided to check the version of each library for the time being.

Ask Google teacher to see if the version of ↑ is correct. (I referred to the article Loading integration test data using DBUnit.)

POI was not the recommended version

According to the article I referred to, the POI version uses 3.2-FINAL. When I tried switching the version, the error disappeared.

Recommended Posts

Error when starting JUnit with deprecated version of POI
Easy JUnit test of Elasticsearch 2018 version with embedded-elasticsearch
Error when playing with java
Cause of DOMA 4019 error when compiling with Gradle suffered for 7 days
A memorandum when starting new development with IntelliJ + Gradle + SpringBoot + JUnit5 (jupiter)
Error when building infrastructure with aws app
Error when starting eclipse after upgrading JDK
Javaw.exe error when starting Spring Boot (STS)
[Laravel] How to deal with out of memory error when composer require [Docker]
[Rails] Error resolution when generating tokens with PAYJP
Manage the version of Ruby itself with rbenv
Overwrite the contents of config with Spring-boot + JUnit5
error code 400 appears when deploying with release: perform
After installing'devise''bootstrap' of gemfile with rails, what to do when url is an error