use of com.android.tools.build.bundletool.validation.SubValidator in project bundletool by google.
the class BuildApksValidationTest method extraValidator_runsValidation.
@Test
public void extraValidator_runsValidation() throws Exception {
createAppBundle(bundlePath);
SubValidator extraValidator = new SubValidator() {
@Override
public void validateBundle(AppBundle bundle) {
throw InvalidBundleException.builder().withUserMessage("Custom validator").build();
}
};
BuildApksCommand command = BuildApksCommand.builder().setBundlePath(bundlePath).setOutputFile(outputFilePath).setExtraValidators(ImmutableList.of(extraValidator)).build();
Exception e = assertThrows(InvalidBundleException.class, command::execute);
assertThat(e).hasMessageThat().contains("Custom validator");
}
Aggregations