package com.google.step.snippet.external;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

import com.google.step.snippet.data.Card;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
public final class W3SchoolsClientTest {

  private final W3SchoolsClient client = new W3SchoolsClient("CSE_ID");

  @Ignore
  @Test
  public void htmlCodeCard() {
    Card actual = client.search("https://www.w3schools.com/tags/tag_img.asp");
    Card expected =
        new Card(
            "HTML <img> Tag",
            "<img alt=\"Girl in a jacket\" width=\"500\" height=\"600\">",
            "https://www.w3schools.com/tags/tag_img.asp",
            "How to insert an image:");
    assertEquals(expected, actual);
  }

  @Test
  public void jsonCodeCard() {
    Card actual = client.search("https://www.w3schools.com/js/js_json_intro.asp");
    Card expected =
        new Card(
            "JSON - Introduction",
            "var myObj = {name: \"John\", age: 31, city: \"New York\"}; var myJSON ="
                + " JSON.stringify(myObj); window.location = \"demo_json.php?x=\" + myJSON;",
            "https://www.w3schools.com/js/js_json_intro.asp",
            "JSON: JavaScript Object Notation.");
    assertEquals(expected, actual);
  }

  @Test
  public void partiallyFilledCard() {
    Card actual = client.search("https://www.w3schools.com/html/html_quiz.asp");
    assertNull(actual);
  }

  @Test
  public void nonexistentLink() {
    Card actual = client.search("https://www.w3schools.com/css/html.asp");
    assertNull(actual);
  }

  @Test
  public void blankPageLink() {
    Card actual = client.search("https://www.w3schools.com/");
    assertNull(actual);
  }
}

@@ -171,33 +171,8 @@
 rd;%0A
-import org.junit.Ignore;%0A
 impo
@@ -190,16 +190,16 @@
 t.Test;%0A
+
 import o
@@ -399,18 +399,8 @@
 );%0A%0A
-  @Ignore%0A
   @T
@@ -573,13 +573,19 @@
 TML 
-%3Cimg%3E
+&lt;img&gt;
  Tag
@@ -604,17 +604,20 @@
    %22
-%3C
+&lt;
 img alt=
 %5C%22Gi
@@ -612,18 +612,22 @@
 img alt=
-%5C%22
+&quot;
 Girl in 
@@ -638,40 +638,63 @@
 cket
-%5C%22
+&quot;
  width=
-%5C%22500%5C%22 height=%5C%22600%5C%22%3E
+&quot;500&quot; height=&quot;600&quot;&gt;
 %22,%0A 

Fix test diff