package com.hpcloud.mon.resource;

import static org.testng.Assert.assertEquals;

import java.nio.charset.Charset;

import org.testng.annotations.Test;

import com.google.common.hash.Hashing;

/**
 * @author Jonathan Halterman
 */
@Test
public class LinksTest {
  public void shouldPrefixForHttps() {
    Links.accessedViaHttps = true;
    assertEquals(Links.prefixForHttps("http://abc123blah/blah/blah"),
        "https://abc123blah/blah/blah");
    assertEquals(Links.prefixForHttps("https://abc123blah/blah/blah"),
        "https://abc123blah/blah/blah");

    // Negative
    Links.accessedViaHttps = false;
    assertEquals(Links.prefixForHttps("http://abc123blah/blah/blah"), "http://abc123blah/blah/blah");
    assertEquals(Links.prefixForHttps("https://abc123blah/blah/blah"),
        "https://abc123blah/blah/blah");
  }

  public void foo() throws Exception {
    byte[] foo = Hashing.sha1()
        .newHasher()
        .putString("foo", Charset.defaultCharset())
        .putString("bar", Charset.defaultCharset())
        .hash()
        .asBytes();
    String text1 = new String(foo, Charset.forName("US-ASCII"));
    int i = 1;
  }
}

@@ -86,109 +86,35 @@
 ort 
-java.nio.charset.Charset;%0A%0Aimport org.testng.annotations.Test;%0A%0Aimport com.google.common.hash.Hashing
+org.testng.annotations.Test
 ;%0A%0A/
@@ -752,324 +752,7 @@
 %0A  %7D
-%0A%0A  public void foo() throws Exception %7B%0A    byte%5B%5D foo = Hashing.sha1()%0A        .newHasher()%0A        .putString(%22foo%22, Charset.defaultCharset())%0A        .putString(%22bar%22, Charset.defaultCharset())%0A        .hash()%0A        .asBytes();%0A    String text1 = new String(foo, Charset.forName(%22US-ASCII%22));%0A    int i = 1;%0A  %7D
 %0A%7D%0A

Test cleanup