### Question:
MultiRFileOutputFormatter extends FileOutputFormat<BulkIngestKey,Value> { public static void setCompressionType(Configuration conf, String compressionType) { if (compressionType != null) { if (!("snappy".equals(compressionType) || "lzo".equals(compressionType) || "gz".equals(compressionType) || "none".equals(compressionType))) throw new IllegalArgumentException("compressionType must be one of snappy, lzo, gz, or none"); conf.set(COMPRESSION_TYPE, compressionType); } }  static void setGenerateMapFileRowKeys(Configuration conf, boolean generateMapFileRowKeys); static void setGenerateMapFilePerShardLocation(Configuration conf, boolean generateMapFilePerShardLocation); static void setCompressionType(Configuration conf, String compressionType); static void setCompressionTableBlackList(Configuration conf, Set<String> compressionTableBlackList); static void setFileType(Configuration conf, String type); static void setAccumuloConfiguration(Configuration conf); static void setRFileLimits(Configuration conf, int maxEntries, long maxSize); static void addTableToLocalityGroupConfiguration(Configuration conf, String tableName); @Override synchronized OutputCommitter getOutputCommitter(TaskAttemptContext context); @Override RecordWriter<BulkIngestKey,Value> getRecordWriter(final TaskAttemptContext context); static final String CONFIGURE_LOCALITY_GROUPS; static final String EVENT_PARTITION_COUNT; static final String EDGE_PARTITION_COUNT; static final String INDEX_PARTITION_COUNT; static final String REV_INDEX_PARTITION_COUNT; static final String LOCATION_PARTITION_COUNT; static final String CONFIGURED_TABLE_NAMES; }### Answer:
@Test(expected = IllegalArgumentException.class) public void testSetCompressionTypeWithBadType() { MultiRFileOutputFormatterTest.logger.info("testSetCompressionTypeWithBadType called..."); try { MultiRFileOutputFormatter.setCompressionType(createMockConfiguration(), "bad-compressor"); Assert.fail("MultiRFileOutputFormatter#setCompressionType failed to throw expected exception."); } finally { MultiRFileOutputFormatterTest.logger.info("testSetCompressionTypeWithBadType completed."); } }
@Test public void testSetCompressionType() { MultiRFileOutputFormatterTest.logger.info("testSetCompressionTypeWithBadType called..."); try { String compressionKey = String.format("%s.compression", MultiRFileOutputFormatter.class.getName()); MultiRFileOutputFormatter.setCompressionType(createMockConfiguration(), null); Assert.assertFalse("MultiRFileOutputFormatter.setCompressionType set compression type when it should not have.", MultiRFileOutputFormatterTest.mockedConfiguration.containsKey(compressionKey)); String expected = "snappy"; MultiRFileOutputFormatter.setCompressionType(createMockConfiguration(), expected); Assert.assertEquals("MultiRFileOutputFormatter.setCompressionType failed to set compression type", expected, MultiRFileOutputFormatterTest.mockedConfiguration.get(compressionKey)); expected = "lzo"; MultiRFileOutputFormatter.setCompressionType(createMockConfiguration(), expected); Assert.assertEquals("MultiRFileOutputFormatter.setCompressionType failed to set compression type", expected, MultiRFileOutputFormatterTest.mockedConfiguration.get(compressionKey)); expected = "gz"; MultiRFileOutputFormatter.setCompressionType(createMockConfiguration(), expected); Assert.assertEquals("MultiRFileOutputFormatter.setCompressionType failed to set compression type", expected, MultiRFileOutputFormatterTest.mockedConfiguration.get(compressionKey)); expected = "none"; MultiRFileOutputFormatter.setCompressionType(createMockConfiguration(), expected); Assert.assertEquals("MultiRFileOutputFormatter.setCompressionType failed to set compression type", expected, MultiRFileOutputFormatterTest.mockedConfiguration.get(compressionKey)); } finally { MultiRFileOutputFormatterTest.logger.info("testSetCompressionTypeWithBadType completed."); } }