package com.opera.core.systems;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class OperaPathsTest {

  @Test
  public void testStart() throws Exception {
    OperaDriver driver = new OperaDriver();

    driver.get("http://t/core/README");

    assertEquals("http://t/core/README", driver.getCurrentUrl());

    driver.shutdown();
  }

}

@@ -75,296 +75,2209 @@
 ls;%0A
-%0Aimport org.junit.Test;%0A%0Apublic class OperaPathsTest %7B%0A%0A  @Test%0A  public void testStart() throws Exception %7B%0A    OperaDriver driver = new OperaDriver();%0A%0A    driver.get(%22http://t/core/README%22);%0A%0A    assertEquals(%22http://t/core/README%22, driver.getCurrentUrl());%0A%0A    driver.shutdown();%0A  %7D%0A
+import static org.junit.Assert.assertNotNull;%0Aimport static org.junit.Assert.assertNotSame;%0A%0Aimport java.lang.reflect.Field;%0Aimport java.util.Collections;%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0Aimport org.junit.Test;%0A%0Apublic class OperaPathsTest %7B%0A  private static OperaPaths paths = new OperaPaths();%0A%0A  @Test%0A  public void testOperaPath() throws Exception %7B%0A    assertNotNull(paths.operaPath());%0A  %7D%0A%0A  @Test%0A  public void testLauncherPath() throws Exception %7B%0A    assertNotNull(paths.operaPath());%0A  %7D%0A%0A  @Test%0A  public void testStart() throws Exception %7B%0A    OperaDriver driver = new OperaDriver();%0A%0A    driver.get(%22http://t/core/README%22);%0A%0A    assertEquals(%22http://t/core/README%22, driver.getCurrentUrl());%0A%0A    driver.shutdown();%0A  %7D%0A%0A  /* These tests mess with the environment variables. So they're at the end */%0A%0A  @Test%0A  public void testOperaEnvVar() throws Exception %7B%0A    assertNotSame(%22/%22, paths.operaPath());%0A%0A    Map%3CString, String%3E env = new HashMap%3CString, String%3E();%0A    env.put(%22OPERA_PATH%22, %22/%22);%0A    setEnv(env);%0A%0A    assertEquals(%22/%22, paths.operaPath());%0A  %7D%0A%0A  @Test%0A  public void testLauncherEnvVar() throws Exception %7B%0A    assertNotSame(%22/%22, paths.launcherPath());%0A%0A    Map%3CString, String%3E env = new HashMap%3CString, String%3E();%0A    env.put(%22OPERA_LAUNCHER%22, %22/%22);%0A    setEnv(env);%0A%0A    assertEquals(%22/%22, paths.launcherPath());%0A  %7D%0A%0A  /**%0A   * Massive hack to set the environment variables inside this JVM. Used to%0A   * test if OperaPaths is checking the env vars.%0A   *%0A   * http://stackoverflow.com/questions/318239/how-do-i-set-environment-variables-from-java/496849#496849%0A   *%0A   * @param newenv The new environment to set%0A   */%0A  private static void setEnv(Map%3CString, String%3E newenv) throws Exception %7B%0A    Class%5B%5D classes = Collections.class.getDeclaredClasses();%0A    Map%3CString, String%3E env = System.getenv();%0A    for (Class cl : classes) %7B%0A      if (%22java.util.Collections$UnmodifiableMap%22.equals(cl.getName())) %7B%0A        Field field = cl.getDeclaredField(%22m%22);%0A        field.setAccessible(true);%0A        Object obj = field.get(env);%0A        Map%3CString, String%3E map = (Map%3CString, String%3E) obj;%0A        map.clear();%0A        map.putAll(newenv);%0A      %7D%0A    %7D%0A  %7D
 %0A%7D%0A

Add more tests for OperaPaths