package org.wikipedia.page;

import android.support.test.filters.SmallTest;
import android.test.AndroidTestCase;

@SmallTest
public class SectionTest extends AndroidTestCase {
    public void testSectionLead() {
        // Section 0 is the lead
        Section section = new Section(0, 0, "Heading", "Heading", "Content");
        assertTrue(section.isLead());

        // Section 1 is not
        section = new Section(1, 1, "Heading", "Heading", "Content");
        assertFalse(section.isLead());

        // Section 1 is not, even if it's somehow at level 0
        section = new Section(1, 0, "Heading", "Heading", "Content");
        assertFalse(section.isLead());
    }

    public void testJSONSerialization() throws Exception {
        Section parentSection = new Section(1, 1, null, null, "Hi there!");

        assertEquals(parentSection, Section.fromJson(parentSection.toJSON()));
    }
}

@@ -73,43 +73,124 @@
 st;%0A
+%0A
 import 
-android.test.AndroidTestCase
+org.junit.Test;%0A%0Aimport static org.hamcrest.MatcherAssert.assertThat;%0Aimport static org.hamcrest.Matchers.is
 ;%0A%0A@
@@ -228,37 +228,19 @@
 est 
-extends AndroidTestCase %7B%0A   
+%7B%0A    @Test
  pub
@@ -398,11 +398,11 @@
 ertT
-rue
+hat
 (sec
@@ -406,32 +406,42 @@
 section.isLead()
+, is(true)
 );%0A%0A        // S
@@ -532,37 +532,36 @@
 ;%0A        assert
-False
+That
 (section.isLead(
@@ -561,16 +561,27 @@
 isLead()
+, is(false)
 );%0A%0A    
@@ -725,13 +725,12 @@
 sert
-False
+That
 (sec
@@ -742,16 +742,27 @@
 isLead()
+, is(false)
 );%0A    %7D
@@ -767,16 +767,22 @@
  %7D%0A%0A    
+@Test 
 public v
@@ -812,25 +812,8 @@
 on()
- throws Exception
  %7B%0A 
@@ -906,14 +906,12 @@
 sert
-Equals
+That
 (par
@@ -922,16 +922,19 @@
 ection, 
+is(
 Section.
@@ -966,16 +966,17 @@
 JSON()))
+)
 ;%0A    %7D%0A

convert SectionTest to JUnit 4