Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enable LocalisationTest #2463

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,91 +23,78 @@
public class LocalisationTest {
private static I18n mockI18n;

@Before
public void setUp() {
mockI18n = mock(I18n.class);
PowerMockito.doReturn("output").when(mockI18n).tr("input");
PowerMockito.mockStatic(I18nFactory.class);
PowerMockito.when(I18nFactory.getI18n(any(), anyString())).thenReturn(mockI18n);
}

@PrepareForTest({ I18nFactory.class, I18n.class })
@Test
public synchronized void testTrWithAString() {
assertEquals("output", tr("input"));
}

@PrepareForTest({ I18nFactory.class, I18n.class })
@Test
public synchronized void dummy() {
public synchronized void testTrWithNull() {
assertNull(tr(null));
}

// TODO: re-enable
/*
* @Before
* public void setUp() {
* mockI18n = mock(I18n.class);
* PowerMockito.doReturn("output").when(mockI18n).tr("input");
* PowerMockito.mockStatic(I18nFactory.class);
* PowerMockito.when(I18nFactory.getI18n(any(), anyString())).thenReturn(mockI18n);
* }
*
* @PrepareForTest({ I18nFactory.class, I18n.class })
*
* @Test
* public synchronized void testTrWithAString() {
* assertEquals("output", tr("input"));
* }
*
* @PrepareForTest({ I18nFactory.class, I18n.class })
*
* @Test
* public synchronized void testTrWithNull() {
* assertNull(tr(null));
* }
*
* @PrepareForTest({ I18nFactory.class, I18n.class })
*
* @Test
* public synchronized void testSimpleTranslatableObject() {
* final SimpleTranslatableObject translatableObject = new SimpleTranslatableObject("input", "input");
* assertEquals("input", translatableObject.getItemNotToBeTranslated());
* assertEquals("input", translatableObject.getItemToBeTranslated());
*
* final SimpleTranslatableObject translatedObject = tr(translatableObject);
* assertEquals("input", translatedObject.getItemNotToBeTranslated());
* assertEquals("output", translatedObject.getItemToBeTranslated());
* }
*
* @PrepareForTest({ I18nFactory.class, I18n.class })
*
* @Test
* public synchronized void testSimpleTranslatableObjectWithBuilder() {
* final SimpleTranslatableObjectBuilder translatableObject = new SimpleTranslatableObjectBuilder.Builder()
* .withItemNotToBeTranslated("input").withItemToBeTranslated("input").build();
* assertEquals("input", translatableObject.getItemNotToBeTranslated());
* assertEquals("input", translatableObject.getItemToBeTranslated());
*
* final SimpleTranslatableObjectBuilder translatedObject = tr(translatableObject);
* assertEquals("input", translatedObject.getItemNotToBeTranslated());
* assertEquals("output", translatedObject.getItemToBeTranslated());
* }
*
* @PrepareForTest({ I18nFactory.class, I18n.class })
*
* @Test
* public synchronized void testTreeTranslatableObject() {
* final TreeTranslatableObject treeTranslatableObject = new TreeTranslatableObject(
* new SimpleTranslatableObject("input", "input"), new SimpleTranslatableObject("input", "input"));
* assertEquals("input", treeTranslatableObject.getItemNotToBeTranslated().getItemToBeTranslated());
* assertEquals("input", treeTranslatableObject.getItemNotToBeTranslated().getItemNotToBeTranslated());
* assertEquals("input", treeTranslatableObject.getItemToBeTranslated().getItemToBeTranslated());
* assertEquals("input", treeTranslatableObject.getItemToBeTranslated().getItemNotToBeTranslated());
*
* final TreeTranslatableObject translatedObject = tr(treeTranslatableObject);
* assertEquals("input", translatedObject.getItemNotToBeTranslated().getItemToBeTranslated());
* assertEquals("input", translatedObject.getItemNotToBeTranslated().getItemNotToBeTranslated());
* assertEquals("output", translatedObject.getItemToBeTranslated().getItemToBeTranslated());
* assertEquals("input", translatedObject.getItemToBeTranslated().getItemNotToBeTranslated());
*
* }
*
* @PrepareForTest({ I18nFactory.class, I18n.class })
*
* @Test
* public synchronized void testTreeTranslatableCollectionObject() {
* final CollectionsOfTranslatableObject collectionsOfTranslatableObject = new CollectionsOfTranslatableObject(
* Arrays.asList("input", "input"), Arrays.asList("input", "input"));
*
* final CollectionsOfTranslatableObject translatedObject = tr(collectionsOfTranslatableObject);
* assertEquals(Arrays.asList("input", "input"), translatedObject.getItemNotToBeTranslated());
* assertEquals(Arrays.asList("output", "output"), translatedObject.getItemToBeTranslated());
* }
*/
@PrepareForTest({ I18nFactory.class, I18n.class })
@Test
public synchronized void testSimpleTranslatableObject() {
final SimpleTranslatableObject translatableObject = new SimpleTranslatableObject("input", "input");
assertEquals("input", translatableObject.getItemNotToBeTranslated());
assertEquals("input", translatableObject.getItemToBeTranslated());

final SimpleTranslatableObject translatedObject = tr(translatableObject);
assertEquals("input", translatedObject.getItemNotToBeTranslated());
assertEquals("output", translatedObject.getItemToBeTranslated());
}

@PrepareForTest({ I18nFactory.class, I18n.class })
@Test
public synchronized void testSimpleTranslatableObjectWithBuilder() {
final SimpleTranslatableObjectBuilder translatableObject = new SimpleTranslatableObjectBuilder.Builder()
.withItemNotToBeTranslated("input").withItemToBeTranslated("input").build();
assertEquals("input", translatableObject.getItemNotToBeTranslated());
assertEquals("input", translatableObject.getItemToBeTranslated());

final SimpleTranslatableObjectBuilder translatedObject = tr(translatableObject);
assertEquals("input", translatedObject.getItemNotToBeTranslated());
assertEquals("output", translatedObject.getItemToBeTranslated());
}

@PrepareForTest({ I18nFactory.class, I18n.class })
@Test
public synchronized void testTreeTranslatableObject() {
final TreeTranslatableObject treeTranslatableObject = new TreeTranslatableObject(
new SimpleTranslatableObject("input", "input"), new SimpleTranslatableObject("input", "input"));
assertEquals("input", treeTranslatableObject.getItemNotToBeTranslated().getItemToBeTranslated());
assertEquals("input", treeTranslatableObject.getItemNotToBeTranslated().getItemNotToBeTranslated());
assertEquals("input", treeTranslatableObject.getItemToBeTranslated().getItemToBeTranslated());
assertEquals("input", treeTranslatableObject.getItemToBeTranslated().getItemNotToBeTranslated());

final TreeTranslatableObject translatedObject = tr(treeTranslatableObject);
assertEquals("input", translatedObject.getItemNotToBeTranslated().getItemToBeTranslated());
assertEquals("input", translatedObject.getItemNotToBeTranslated().getItemNotToBeTranslated());
assertEquals("output", translatedObject.getItemToBeTranslated().getItemToBeTranslated());
assertEquals("input", translatedObject.getItemToBeTranslated().getItemNotToBeTranslated());

}

@PrepareForTest({ I18nFactory.class, I18n.class })
@Test
public synchronized void testTreeTranslatableCollectionObject() {
final CollectionsOfTranslatableObject collectionsOfTranslatableObject = new CollectionsOfTranslatableObject(
Arrays.asList("input", "input"), Arrays.asList("input", "input"));

final CollectionsOfTranslatableObject translatedObject = tr(collectionsOfTranslatableObject);
assertEquals(Arrays.asList("input", "input"), translatedObject.getItemNotToBeTranslated());
assertEquals(Arrays.asList("output", "output"), translatedObject.getItemToBeTranslated());
}

}