/** Test of toString method, of class Language. */
 @Test
 public void testToString() {
   SpokenDialect instance = SpokenDialect.ENGLISH_UNITED_STATES;
   String expResult = "en-us";
   String result = instance.toString();
   assertEquals(expResult, result);
 }
  @Test
  public void testGetSpokenDialect_NoKey() throws Exception {
    SpokenDialect.flushNameCache();
    SpokenDialect.setKey(null);
    Language locale = Language.ENGLISH;

    exception.expect(RuntimeException.class);
    exception.expectMessage(
        "INVALID_API_KEY - Please set the API Key with your Bing Developer's Key");
    SpokenDialect.FRENCH_CANADA.getName(locale);
  }
 /** Test of fromString method, of class Language. */
 @Test
 public void testFromString() {
   String pLanguage = "en-us";
   SpokenDialect expResult = SpokenDialect.ENGLISH_UNITED_STATES;
   SpokenDialect result = SpokenDialect.fromString(pLanguage);
   assertEquals(expResult, result);
 }
 /** Test of valueOf method, of class Language. */
 @Test
 public void testValueOf() {
   String name = "ENGLISH_UNITED_STATES";
   SpokenDialect expResult = SpokenDialect.ENGLISH_UNITED_STATES;
   SpokenDialect result = SpokenDialect.valueOf(name);
   assertEquals(expResult, result);
 }
 @Before
 public void setUp() throws Exception {
   p = new Properties();
   URL url = ClassLoader.getSystemResource("META-INF/config.properties");
   p.load(url.openStream());
   String apiKey = p.getProperty("microsoft.translator.api.key");
   if (System.getProperty("test.api.key") != null) {
     apiKey = System.getProperty("test.api.key");
   }
   SpokenDialect.setKey(apiKey);
 }