@Test public void testMicrosoftTranslateToFrench() { String text = "hello"; String expected = "salut"; String translated = translatorExample.microsoftTranslateToFrench(text); if (!translated.equals(text)) assertEquals(expected, translated.toLowerCase(Locale.ROOT)); }
public String microsoftTranslateToFrench(String text) { MicrosoftTranslator translator = new MicrosoftTranslator(); translator.setId("dummy-id"); translator.setSecret("dummy-secret"); try { return translator.translate(text, "fr"); } catch (Exception e) { return "Error while translating."; } }
TranslatorExample { public String microsoftTranslateToFrench(String text) { MicrosoftTranslator translator = new MicrosoftTranslator(); translator.setId("dummy-id"); translator.setSecret("dummy-secret"); try { return translator.translate(text, "fr"); } catch (Exception e) { return "Error while translating."; } } }
TranslatorExample { public String microsoftTranslateToFrench(String text) { MicrosoftTranslator translator = new MicrosoftTranslator(); translator.setId("dummy-id"); translator.setSecret("dummy-secret"); try { return translator.translate(text, "fr"); } catch (Exception e) { return "Error while translating."; } }  }
TranslatorExample { public String microsoftTranslateToFrench(String text) { MicrosoftTranslator translator = new MicrosoftTranslator(); translator.setId("dummy-id"); translator.setSecret("dummy-secret"); try { return translator.translate(text, "fr"); } catch (Exception e) { return "Error while translating."; } }  String microsoftTranslateToFrench(String text); }
TranslatorExample { public String microsoftTranslateToFrench(String text) { MicrosoftTranslator translator = new MicrosoftTranslator(); translator.setId("dummy-id"); translator.setSecret("dummy-secret"); try { return translator.translate(text, "fr"); } catch (Exception e) { return "Error while translating."; } }  String microsoftTranslateToFrench(String text);  }