Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test code improvement and cleanup #132

Merged
merged 1 commit into from
Aug 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import java.util.Properties;

import static org.assertj.core.api.BDDAssertions.then;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.fail;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -59,23 +58,23 @@ public void overridesAsMap() {
map.put(S3_SPI_READ_MAX_FRAGMENT_SIZE_PROPERTY, "1212");
S3NioSpiConfiguration c = new S3NioSpiConfiguration(map);

assertEquals(1212, c.getMaxFragmentSize());
then(c.getMaxFragmentSize()).isEqualTo(1212);
}

@Test
public void getS3SpiReadMaxFragmentSize() {
assertEquals(S3_SPI_READ_MAX_FRAGMENT_SIZE_DEFAULT, config.getMaxFragmentSize());
then(config.getMaxFragmentSize()).isEqualTo(S3_SPI_READ_MAX_FRAGMENT_SIZE_DEFAULT);

assertEquals(1111, overriddenConfig.getMaxFragmentSize());
assertEquals(S3_SPI_READ_MAX_FRAGMENT_SIZE_DEFAULT, badOverriddenConfig.getMaxFragmentSize());
then(overriddenConfig.getMaxFragmentSize()).isEqualTo(1111);
then(badOverriddenConfig.getMaxFragmentSize()).isEqualTo(S3_SPI_READ_MAX_FRAGMENT_SIZE_DEFAULT);
}

@Test
public void getS3SpiReadMaxFragmentNumber() {
assertEquals(S3_SPI_READ_MAX_FRAGMENT_NUMBER_DEFAULT, config.getMaxFragmentNumber());
then(config.getMaxFragmentNumber()).isEqualTo(S3_SPI_READ_MAX_FRAGMENT_NUMBER_DEFAULT);

assertEquals(2, overriddenConfig.getMaxFragmentNumber());
assertEquals(S3_SPI_READ_MAX_FRAGMENT_NUMBER_DEFAULT, badOverriddenConfig.getMaxFragmentNumber());
then(overriddenConfig.getMaxFragmentNumber()).isEqualTo(2);
then(badOverriddenConfig.getMaxFragmentNumber()).isEqualTo(S3_SPI_READ_MAX_FRAGMENT_NUMBER_DEFAULT);
}

@Test
Expand Down Expand Up @@ -198,6 +197,7 @@ public void withAndGetCredentials() {
then(config.withCredentials(C2)).isSameAs(config);
then(config.getCredentials()).isSameAs(C2);
then(config.withCredentials(null).getCredentials()).isNull();
then(config.withCredentials(C1).withCredentials(null, null).getCredentials()).isNull();

//
// withCredentials(AwsCredentials) takes priority over withCredentialas(String, String)
Expand All @@ -212,10 +212,10 @@ public void withAndGetCredentials() {
@Test
public void convertPropertyNameToEnvVar() {
String expected = "FOO_BAA_FIZZ_BUZZ";
assertEquals(expected, config.convertPropertyNameToEnvVar("foo.baa.fizz-buzz"));
then(config.convertPropertyNameToEnvVar("foo.baa.fizz-buzz")).isEqualTo(expected);

expected = "";
assertEquals(expected, config.convertPropertyNameToEnvVar(null));
assertEquals(expected, config.convertPropertyNameToEnvVar(" "));
then(config.convertPropertyNameToEnvVar(null)).isEqualTo(expected);
then(config.convertPropertyNameToEnvVar(" ")).isEqualTo(expected);
}
}