Home | History | Annotate | Download | only in robolectric
      1 package org.robolectric;
      2 
      3 import static org.junit.Assert.assertEquals;
      4 
      5 import java.io.StringReader;
      6 import org.json.JSONObject;
      7 import org.junit.Test;
      8 import org.junit.runner.RunWith;
      9 import org.xmlpull.v1.XmlPullParser;
     10 import org.xmlpull.v1.XmlPullParserFactory;
     11 
     12 @RunWith(RobolectricTestRunner.class)
     13 public class IncludedDependenciesTest {
     14   @Test
     15   public void jsonShouldWork() throws Exception {
     16     assertEquals("value", new JSONObject("{'name':'value'}").getString("name"));
     17   }
     18 
     19   @Test
     20   public void xppShouldWork() throws Exception {
     21     XmlPullParser xmlPullParser = XmlPullParserFactory.newInstance().newPullParser();
     22     xmlPullParser.setInput(new StringReader("<?xml version=\"1.0\" encoding=\"UTF-8\"?><test name=\"value\"/>"));
     23     assertEquals(XmlPullParser.START_TAG, xmlPullParser.nextTag());
     24     assertEquals(1, xmlPullParser.getAttributeCount());
     25     assertEquals("name", xmlPullParser.getAttributeName(0));
     26     assertEquals("value", xmlPullParser.getAttributeValue(0));
     27   }
     28 }
     29