### Question:
HardLink { public static int getLinkCount(File fileName) throws IOException { if (fileName == null) { throw new IOException( "invalid argument to getLinkCount: file name is null"); } if (!fileName.exists()) { throw new FileNotFoundException(fileName + " not found."); } String[] cmd = getHardLinkCommand.linkCount(fileName); String inpMsg = null; String errMsg = null; int exitValue = -1; BufferedReader in = null; BufferedReader err = null; Process process = Runtime.getRuntime().exec(cmd); try { exitValue = process.waitFor(); in = new BufferedReader(new InputStreamReader( process.getInputStream())); inpMsg = in.readLine(); err = new BufferedReader(new InputStreamReader( process.getErrorStream())); errMsg = err.readLine(); if (inpMsg == null || exitValue != 0) { throw createIOException(fileName, inpMsg, errMsg, exitValue, null); } if (osType == OSType.OS_TYPE_SOLARIS) { String[] result = inpMsg.split("\\s+"); return Integer.parseInt(result[1]); } else { return Integer.parseInt(inpMsg); } } catch (NumberFormatException e) { throw createIOException(fileName, inpMsg, errMsg, exitValue, e); } catch (InterruptedException e) { throw createIOException(fileName, inpMsg, errMsg, exitValue, e); } finally { process.destroy(); if (in != null) in.close(); if (err != null) err.close(); } } HardLink(); static void createHardLink(File file, File linkName); static void createHardLinkMult(File parentDir, String[] fileBaseNames, 
      File linkDir); static int getLinkCount(File fileName); static OSType osType; final LinkStats linkStats; }### Answer:
@Test public void testGetLinkCount() throws IOException { assertEquals(1, getLinkCount(x1)); assertEquals(1, getLinkCount(x2)); assertEquals(1, getLinkCount(x3)); }