### Question:
HardLink { public static void createHardLink(File file, File linkName) throws IOException { if (file == null) { throw new IOException( "invalid arguments to createHardLink: source file is null"); } if (linkName == null) { throw new IOException( "invalid arguments to createHardLink: link name is null"); } String[] hardLinkCommand = getHardLinkCommand.linkOne(file, linkName); Process process = Runtime.getRuntime().exec(hardLinkCommand); try { if (process.waitFor() != 0) { String errMsg = new BufferedReader(new InputStreamReader( process.getInputStream())).readLine(); if (errMsg == null) errMsg = ""; String inpMsg = new BufferedReader(new InputStreamReader( process.getErrorStream())).readLine(); if (inpMsg == null) inpMsg = ""; throw new IOException(errMsg + inpMsg); } } catch (InterruptedException e) { throw new IOException(e); } finally { process.destroy(); } } 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 testCreateHardLink() throws IOException { createHardLink(x1, x1_one); assertTrue(x1_one.exists()); assertEquals(2, getLinkCount(x1)); assertEquals(2, getLinkCount(x1_one)); assertEquals(1, getLinkCount(x2)); createHardLink(x2, y_one); createHardLink(x3, x3_one); assertEquals(2, getLinkCount(x2)); assertEquals(2, getLinkCount(x3)); createHardLink(x1, x11_one); assertEquals(3, getLinkCount(x1)); assertEquals(3, getLinkCount(x1_one)); assertEquals(3, getLinkCount(x11_one)); validateTgtOne(); appendToFile(x1_one, str3); assertTrue(fetchFileContents(x1_one).equals(str1 + str3)); assertTrue(fetchFileContents(x11_one).equals(str1 + str3)); assertTrue(fetchFileContents(x1).equals(str1 + str3)); }