### Question:
BuildConfiguration implements Serializable { boolean isValidWindowsFileName(String filename) { Pattern pattern = Pattern.compile( "# Match a valid Windows filename (unspecified file system). \n" + "^ # Anchor to start of string. \n" + "(?! # Assert filename is not: CON, PRN, \n" + " (?: # AUX, NUL, COM1, COM2, COM3, COM4, \n" + " CON|PRN|AUX|NUL| # COM5, COM6, COM7, COM8, COM9, \n" + " COM[1-9]|LPT[1-9] # LPT1, LPT2, LPT3, LPT4, LPT5, \n" + " ) # LPT6, LPT7, LPT8, and LPT9... \n" + " (?:\\.[^.]*)? # followed by optional extension \n" + " $ # and end of string \n" + ") # End negative lookahead assertion. \n" + "[^<>:\"/\\\\|?*\\x00-\\x1F]* # Zero or more valid filename chars.\n" + "[^<>:\"/\\\\|?*\\x00-\\x1F .] # Last char is not a space or dot. \n" + "$ # Anchor to end of string. ", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE | Pattern.COMMENTS); Matcher matcher = pattern.matcher(filename); return matcher.matches(); } BuildConfiguration(); boolean isDockerFileMode(); File getDockerFile(); File getDockerArchive(); File getContextDir(); String getFilter(); String getDockerFileRaw(); String getContextDirRaw(); Arguments getShell(); String getDockerArchiveRaw(); String getDockerFileDirRaw(); String getFilterRaw(); String getFrom(); Map<String, String> getFromExt(); String getRegistry(); String getMaintainer(); String getWorkdir(); AssemblyConfiguration getAssemblyConfiguration(); List<String> getPorts(); String getImagePullPolicy(); List<String> getVolumes(); List<String> getTags(); Map<String, String> getEnv(); Map<String, String> getLabels(); Arguments getCmd(); String getCleanupMode(); Boolean getNoCache(); Boolean getOptimise(); Boolean getSkip(); ArchiveCompression getCompression(); Map<String, String> getBuildOptions(); Arguments getEntryPoint(); List<String> getRunCmds(); String getUser(); HealthCheckConfiguration getHealthCheck(); Map<String, String> getArgs(); boolean optimise(); @Deprecated String getCommand(); String getCleanup(); boolean nocache(); CleanupMode cleanupMode(); File getAbsoluteContextDirPath(String sourceDirectory, String projectBaseDir); File getAbsoluteDockerFilePath(String sourceDirectory, String projectBaseDir); File getAbsoluteDockerTarPath(String sourceDirectory, String projectBaseDir); String initAndValidate(KitLogger log); String validate(); File calculateDockerFilePath(); static final String DEFAULT_FILTER; static final String DEFAULT_CLEANUP; }### Answer:
@Test public void isValidWindowsFileName() { BuildConfiguration cfg = new BuildConfiguration(); assertFalse(cfg.isValidWindowsFileName("/Dockerfile")); assertTrue(cfg.isValidWindowsFileName("Dockerfile")); assertFalse(cfg.isValidWindowsFileName("Dockerfile/")); }