Sha256: b136d1c6ce78883e0cfef49a874f77c118b99b99c7a88d4aeabbfbaa5ed3df57

Contents?: true

Size: 1.41 KB

Versions: 4

Compression:

Stored size: 1.41 KB

Contents

package org.embulk.output.s3v2.strategy;

import org.embulk.output.s3v2.PluginTask;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;

/**
 * @see BufferedStrategy
 */
@ExtendWith(MockitoExtension.class)
public class BufferedStrategyTests
{
    private PluginTask task;

    @BeforeEach
    public void setUp()
    {
        task = Mockito.mock(PluginTask.class);
        Mockito.doReturn("ap-northeast-1").when(task).getRegion();
    }

    @Test
    @DisplayName("Test validate true")
    public void testValidateTrue() throws Exception
    {
        Mockito.doReturn(false).when(task).getEnableMultiPartUpload();
        BufferedStrategy output = new BufferedStrategy(task, 0);
        Assertions.assertTrue(output.validate());
    }

    @Test
    @DisplayName("Test validate false")
    public void testValidateInvalidCase() throws Exception
    {
        Mockito.doReturn(true).when(task).getEnableMultiPartUpload();
        UnsupportedOperationException ex = Assertions.assertThrows(UnsupportedOperationException.class,
                () -> new BufferedStrategy(task, 0));
        Assertions.assertEquals("Buffering strategy does not support S3 multi-part upload.", ex.getMessage());
    }
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
embulk-output-s3v2-0.3.0 src/test/java/org/embulk/output/s3v2/strategy/BufferedStrategyTests.java
embulk-output-s3v2-0.2.1 src/test/java/org/embulk/output/s3v2/strategy/BufferedStrategyTests.java
embulk-output-s3v2-0.2.0 src/test/java/org/embulk/output/s3v2/strategy/BufferedStrategyTests.java
embulk-output-s3v2-0.1.0 src/test/java/org/embulk/output/s3v2/strategy/BufferedStrategyTests.java