This commit demonstrates a few instances where assertj yields more
informative error messages than testng assertEquals and assertTrue.
Note that we could replace all testng asserts with assertj.
This commit addresses some problems found in the code:
- Now VaultMetadata returns a copy of the creation date instead
of their own instance.
- Added a checkNotNull for PaginatedVaultCollection iterable.
- Added a test for listVaults with an empty list of vaults.
For each test, we were forcing the server to discard the content of
the request body on @BeforeMethod. We need to do this on tests with a
huge body, but it may interfere with other tests which actually use
the body data. To fix this problem, we moved the body limit
restriction to the tests that require it.
Now the validators use checkArgument instead of throwing an
exception by calling an static method.
There were some missing validators on the Async client, these
were fixed too.
Lastly, TreeHash inner class was removed. Now the factory methods
are in the TreeHash class.
GlacierClientMockTest was growing uncontrollably. This commit
is an attempt to fix this problem.
The first measure taken moves the duplicated strings to constants
and the JSON response bodies to resource files. In addition, some
repeated code was moved to static classes, where they can be reused.
We also use @BeforeTest and @AfterTest to make instances of the
MockWebServer and shut them down for each test.
On the last commit we added TestUtils class. On this commit
the VaultNameValidator and the ThreeHashTest tests make use
of it.
GlacierClientMockTest was not using GlacierHeaders references.
This commit fixes this problem too.
In addition, the AWSRequestSignerV4, the TreeHash and the
VaultNameValidator classes are now final.
Now the Glacier client supports upload and delete archive
operations.
An static TestUtils class has been made for the archive operations
tests. This class allows us to build payloads and build ByteSources.
The TreeHash class stores two HashCodes, the linear and the
tree HashCode. The TreeHash class also has an static inner class
named Hasher, which allows us to calculate the hashes.
Both Hashes (tree and linear) are needed for the upload archive
and the multipart upload operations. When completing a multipart
upload operation we also need to calculate the tree hash of the
individual part's hashes.