public void testTranslateGuessLanguage() { String source = "C'est une merveilleuse journée pour traduction"; String expected = "It is a wonderful day for translation"; String result = null; if (translator.isAvailable()) { try { result = translator.translate(source, "en"); assertNotNull(result); assertEquals( "Result: [" + result + "]: not equal to expected: [" + expected + "]", expected, result); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } } }
public void testSimpleTranslate() { String source = "Hola, hoy es un día genial para traducir"; String expected = "Hello, today is a great day to translate"; String result = null; if (translator.isAvailable()) { try { result = translator.translate(source, "es", "en"); assertNotNull(result); assertEquals( "Result: [" + result + "]: not equal to expected: [" + expected + "]", expected, result); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } } }