• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.robolectric;
2 
3 import static org.junit.Assert.assertEquals;
4 import static org.junit.Assert.assertFalse;
5 import static org.junit.Assert.assertTrue;
6 
7 import org.junit.After;
8 import org.junit.Before;
9 import org.junit.Test;
10 import org.junit.runner.RunWith;
11 import org.junit.runners.JUnit4;
12 
13 @RunWith(JUnit4.class)
14 public class RoboSettingsTest {
15 
16   private String originalMavenRepositoryId;
17   private String originalMavenRepositoryUrl;
18   private String originalMavenRepositoryUserName;
19   private String originalMavenRepositoryPassword;
20   private boolean originalUseGlobalScheduler;
21 
22   @Before
setUp()23   public void setUp() {
24     originalMavenRepositoryId = RoboSettings.getMavenRepositoryId();
25     originalMavenRepositoryUrl = RoboSettings.getMavenRepositoryUrl();
26     originalMavenRepositoryUserName = RoboSettings.getMavenRepositoryUserName();
27     originalMavenRepositoryPassword = RoboSettings.getMavenRepositoryPassword();
28     originalUseGlobalScheduler = RoboSettings.isUseGlobalScheduler();
29   }
30 
31   @After
tearDown()32   public void tearDown() {
33     RoboSettings.setMavenRepositoryId(originalMavenRepositoryId);
34     RoboSettings.setMavenRepositoryUrl(originalMavenRepositoryUrl);
35     RoboSettings.setMavenRepositoryUserName(originalMavenRepositoryUserName);
36     RoboSettings.setMavenRepositoryPassword(originalMavenRepositoryPassword);
37     RoboSettings.setUseGlobalScheduler(originalUseGlobalScheduler);
38   }
39 
40   @Test
getMavenRepositoryId_defaultSonatype()41   public void getMavenRepositoryId_defaultSonatype() {
42     assertEquals("sonatype", RoboSettings.getMavenRepositoryId());
43   }
44 
45   @Test
setMavenRepositoryId()46   public void setMavenRepositoryId() {
47     RoboSettings.setMavenRepositoryId("testRepo");
48     assertEquals("testRepo", RoboSettings.getMavenRepositoryId());
49   }
50 
51   @Test
getMavenRepositoryUrl_defaultSonatype()52   public void getMavenRepositoryUrl_defaultSonatype() {
53     assertEquals("https://oss.sonatype.org/content/groups/public/", RoboSettings.getMavenRepositoryUrl());
54   }
55 
56   @Test
setMavenRepositoryUrl()57   public void setMavenRepositoryUrl() {
58     RoboSettings.setMavenRepositoryUrl("http://local");
59     assertEquals("http://local", RoboSettings.getMavenRepositoryUrl());
60   }
61 
62   @Test
setMavenRepositoryUserName()63   public void setMavenRepositoryUserName() {
64     RoboSettings.setMavenRepositoryUserName("username");
65     assertEquals("username", RoboSettings.getMavenRepositoryUserName());
66   }
67 
68   @Test
setMavenRepositoryPassword()69   public void setMavenRepositoryPassword() {
70     RoboSettings.setMavenRepositoryPassword("password");
71     assertEquals("password", RoboSettings.getMavenRepositoryPassword());
72   }
73 
74   @Test
isUseGlobalScheduler_defaultFalse()75   public void isUseGlobalScheduler_defaultFalse() {
76     assertFalse(RoboSettings.isUseGlobalScheduler());
77   }
78 
79   @Test
setUseGlobalScheduler()80   public void setUseGlobalScheduler() {
81     RoboSettings.setUseGlobalScheduler(true);
82     assertTrue(RoboSettings.isUseGlobalScheduler());
83   }
84 }
85