Esempio n. 1
0
 @Test(expected = TmcCoreException.class)
 public void settingsWithoutCredentials() throws TmcCoreException {
   CoreTestSettings localSettings = new CoreTestSettings();
   localSettings.setCurrentCourse(
       new TmcJsonParser(settings).getCourseFromString(ExampleJson.courseExample));
   DownloadExercises de = new DownloadExercises(new ArrayList<Exercise>(), localSettings);
   de.checkData();
 }
Esempio n. 2
0
 @Test
 public void constructorWithoutPathUsesTmcSettings() throws TmcCoreException {
   String path = "pentti/tmc/java";
   settings.setCurrentCourse(new Course());
   settings.setTmcMainDirectory(path);
   DownloadExercises de = new DownloadExercises(new ArrayList<Exercise>(), settings);
   assertTrue(de.data.containsKey("path"));
   assertEquals(path, de.data.get("path"));
 }
Esempio n. 3
0
 @Before
 public void setup() throws IOException {
   settings = new CoreTestSettings();
   settings.setUsername("Bossman");
   settings.setPassword("Samu");
   cache = Paths.get("src", "test", "resources", "downloadtest.cache").toFile();
   cache.createNewFile();
   parser = Mockito.mock(TmcJsonParser.class);
   this.core = new TmcCore();
 }
Esempio n. 4
0
 @Test
 public void courseIdNotANumber() throws TmcCoreException {
   settings.setCurrentCourse(
       new TmcJsonParser(settings).getCourseFromString(ExampleJson.courseExample));
   DownloadExercises de = new DownloadExercises(new ArrayList<Exercise>(), settings);
   de.checkData();
 }
Esempio n. 5
0
 private CoreTestSettings createSettingsAndWiremock() {
   CoreTestSettings settings1 = new CoreTestSettings();
   String serverAddress = "http://127.0.0.1:8080";
   settings1.setServerAddress(serverAddress);
   settings1.setUsername("test");
   settings1.setPassword("1234");
   wiremock(settings1.getUsername(), settings1.getPassword(), "35", serverAddress);
   return settings1;
 }