Skip to content

Commit

Permalink
Improve code test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Symbianx committed May 20, 2020
1 parent 94b4fbf commit abcb768
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/source/policies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ Simple Batch
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This policy's behaviour is similar to the Simple policy but it will process files in batches instead
of processing them all at once.
of processing all the files at once.

You can learn more about the properties of this policy :ref:`here<config_options-policies-simple_batch>`.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.IOException;
Expand Down Expand Up @@ -78,4 +79,17 @@ public void execPolicyBatchesFiles(PolicyFsTestConfig fsConfig) throws IOExcepti
assertFalse(it.hasNext());
assertTrue(fsConfig.getPolicy().hasEnded());
}

@ParameterizedTest
@MethodSource("fileSystemConfigProvider")
public void invalidBatchSize(PolicyFsTestConfig fsConfig) {
Map<String, String> configMap = buildConfigMap(fsConfig.getDirectories());
configMap.put(SimpleBatchPolicy.BATCH_POLICY_BATCH_SIZE, "one");
FsSourceTaskConfig sourceTaskConfig = new FsSourceTaskConfig(configMap);
assertThrows(NumberFormatException.class, () -> {
ReflectionUtils.makePolicy((Class<? extends Policy>) fsConfig.getSourceTaskConfig()
.getClass(FsSourceTaskConfig.POLICY_CLASS), sourceTaskConfig);
});

}
}

0 comments on commit abcb768

Please sign in to comment.