alibaba / innodb-java-reader

A library and command-line tool to access MySQL InnoDB data file directly in Java
Apache License 2.0
462 stars 115 forks source link

Update testRangeQueryByPrimaryKeyNegative assertion logic #39

Closed shunfan-shao closed 2 years ago

shunfan-shao commented 2 years ago

This commit updates the testing behavior of com.alibaba.innodb.java.reader.InnodbReaderBootstrapTest.testRangeQueryByPrimaryKeyNegative

I think the original test would not really guarantee anything. I changed the behavior so that it uses the return result of the setup function. In this way, the test is able to at least determine whether the program can run with the given arguments.

It tests for invalid input arguments and is supposed to throw an exception, which is caught during the program thus cannot be checked during test. I have two proposal for better testing behaviors.

  1. One can conclude some enum values to describe successful or error status.
  2. The test can take advantage of the log and maybe mock the log behavior and check the logs at the end.
CLAassistant commented 2 years ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

neoremind commented 2 years ago

@shunfan-shao Thanks for your contribution!