title: Need to write JUnit Test case
body: <p>I am a fresher java developer.
  But I dont have much knowledge about writing Junit test cases.
  I am going to have a job test soon. 
  For which they want me to write a program </p>
  
  <ol>
  <li>To read HTML from any website say "http://www.google.com" ( You
  can use any API of inbuilt APIs in Java like URLConnection )</li>
  <li>Print on console the HTML from the url above and save it to a file (
  web-content.txt) in local machine.</li>
  <li>JUnit test cases for above
  programme.</li>
  </ol>
  
  <p>I have completed the first two steps as below:</p>
  
  <pre><code>import java.io.*;
  import java.net.*;
  
  public class JavaSourceViewer{
    public static void main (String[] args) throws IOException{
      System.out.print("Enter url of local for viewing html source code: ");
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      String url = br.readLine();
      try {
        URL u = new URL(url);
        HttpURLConnection uc = (HttpURLConnection) u.openConnection();
        int code = uc.getResponseCode();
        String response = uc.getResponseMessage();
        System.out.println("HTTP/1.x " + code + " " + response);
  
        InputStream in = new BufferedInputStream(uc.getInputStream());
        Reader r = new InputStreamReader(in);
        int c;
        FileOutputStream fout=new FileOutputStream("D://web-content.txt");
        while((c = r.read()) != -1){
          System.out.print((char)c);
          fout.write(c);
        }
        fout.close();
      } catch(MalformedURLException ex) {
        System.err.println(url + " is not a valid URL.");
      } catch (IOException ie) {
        System.out.println("Input/Output Error: " + ie.getMessage());
      }
    }
  }    
  </code></pre>
  
  <p>Now I need help with 3rd step.</p>