### Question:
DefaultOutputWrapperFactory implements OutputWrapperFactory { static String getFileName(String target, PartitionData partitionData, OutputStreamFlags outputFlags, int fileVersion) { String result = target; if (outputFlags.isNoAppend() || (outputFlags.getMaxFileSize() > 0)) { String versionString = Integer.toString(fileVersion); checkArgument(versionString.length() <= partitionData.getPadTo(), "fileVersion (%s) cannot be longer than %s digits or else padding will loop; try {{PART:%s}}", fileVersion, partitionData.getPadTo(), versionString.length()); String part = LessStrings.padleft(versionString, partitionData.getPadTo(), LessStrings.pad0); if (partitionData.getReplacementString() != null) { result = target.replace(partitionData.getReplacementString(), part); } else { result = target.concat("-").concat(part); } if (outputFlags.isCompress()) { CompressionType type = outputFlags.getCompressType(); result = result.concat(type.suffix); } } if (outputFlags.isCompress()) { CompressionType type = outputFlags.getCompressType(); if (!result.endsWith(type.suffix)) { result = result.concat(type.suffix); } } log.debug("[file] compress={} compressType:{} na={} for {}", outputFlags.isCompress(), outputFlags.getCompressType(), outputFlags.isNoAppend(), result); return result; } @VisibleForTesting @Deprecated  DefaultOutputWrapperFactory(); @JsonCreator  DefaultOutputWrapperFactory(@JsonProperty("dir") String dir); @Override OutputWrapper openWriteStream(String target,
                                         OutputStreamFlags outputFlags,
                                         OutputStreamEmitter streamEmitter); @Nonnull @Override ImmutableList<Path> writableRootPaths();  }### Answer:
@Test public void testGetFileName() throws Exception { Class[] parameterTypes = new Class[4]; parameterTypes[0] = String.class; parameterTypes[1] = PartitionData.class; parameterTypes[2] = OutputStreamFlags.class; parameterTypes[3] = int.class; Method m = localWriteStream.getClass().getDeclaredMethod("getFileName", parameterTypes); m.setAccessible(true); Object[] parameters = new Object[4]; parameters[0] = "foo"; parameters[1] = new PartitionData(null, 3); parameters[2] = Configs.decodeObject(OutputStreamFlags.class, "compressType:GZIP, compress:true"); parameters[3] = 0; String result = (String) m.invoke(localWriteStream, parameters); assertNotNull(result); assertEquals("foo.gz", result); }