Skip to content

Commit

Permalink
Add skip metadata test
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-wtrefon committed Oct 23, 2024
1 parent e30c7e0 commit ea5505b
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.stream.Stream;
import net.snowflake.client.jdbc.internal.fasterxml.jackson.core.JsonProcessingException;
import net.snowflake.client.jdbc.internal.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
Expand Down Expand Up @@ -113,6 +114,20 @@ void shouldMapMetadata(String description, SnowflakeTableRow row, Map<String, Ob
assertThat(resultSchematized.get(Utils.TABLE_COLUMN_METADATA)).isEqualTo(expected);
}

@Test
void shouldSkipMapMetadata() throws JsonProcessingException {
// Given
SnowflakeTableRow row = buildRow(primitiveJsonExample);

// When
Map<String, Object> result = mapper.processSnowflakeRecord(row, false, false);
Map<String, Object> resultSchematized = mapper.processSnowflakeRecord(row, true, false);

// Then
assertThat(result).doesNotContainKey(Utils.TABLE_COLUMN_METADATA);
assertThat(resultSchematized).doesNotContainKey(Utils.TABLE_COLUMN_METADATA);
}

@ParameterizedTest(name = "{0}")
@MethodSource("prepareNoSchematizationData")
void shouldMapRecord_schematizationDisabled(
Expand Down

0 comments on commit ea5505b

Please sign in to comment.