1package com.xtremelabs.robolectric.internal;
2
3import android.app.Application;
4import com.xtremelabs.robolectric.TestApplication;
5import org.junit.Test;
6
7import static org.junit.Assert.assertEquals;
8
9public class ClassNameResolverTest {
10    @Test
11    public void shouldResolveClassesBySimpleName() throws Exception {
12        assertEquals(TestApplication.class, new ClassNameResolver<Application>("com.xtremelabs.robolectric", "TestApplication").resolve());
13    }
14
15    @Test
16    public void shouldResolveClassesByDottedSimpleName() throws Exception {
17        assertEquals(TestApplication.class, new ClassNameResolver<Application>("com.xtremelabs.robolectric", ".TestApplication").resolve());
18    }
19
20    @Test
21    public void shouldResolveClassesByFullyQualifiedName() throws Exception {
22        assertEquals(TestApplication.class, new ClassNameResolver<Application>("com.xtremelabs.robolectric", "com.xtremelabs.robolectric.TestApplication").resolve());
23    }
24
25    @Test
26    public void shouldResolveClassesByPartiallyQualifiedName() throws Exception {
27        assertEquals(TestApplication.class, new ClassNameResolver<Application>("com.xtremelabs", ".robolectric.TestApplication").resolve());
28    }
29
30    @Test(expected = RuntimeException.class)
31    public void shouldNotResolveClassesByUndottedPartiallyQualifiedNameBecauseAndroidDoesnt() throws Exception {
32        new ClassNameResolver<Application>("com.xtremelabs", "robolectric.TestApplication").resolve();
33    }
34}
35