remove legacy tests
This commit is contained in:
parent
0030e77234
commit
4b34fe357f
@ -0,0 +1,54 @@
|
||||
package de.marhali.easyi18n;
|
||||
|
||||
import de.marhali.easyi18n.model.KeyPath;
|
||||
import de.marhali.easyi18n.model.KeyPathConverter;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link KeyPathConverter}.
|
||||
* @author marhali
|
||||
*/
|
||||
@Deprecated
|
||||
public class LegacyKeyPathConverterTest {
|
||||
|
||||
private final KeyPathConverter deepMapper = new KeyPathConverter(true);
|
||||
private final KeyPathConverter flatMapper = new KeyPathConverter(false);
|
||||
|
||||
@Test
|
||||
public void testNestedConcat() {
|
||||
Assert.assertEquals("first\\\\.section.second.third",
|
||||
deepMapper.concat(KeyPath.of("first.section", "second", "third")));
|
||||
|
||||
Assert.assertEquals("first.second.third",
|
||||
deepMapper.concat(KeyPath.of("first", "second", "third")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNestedSplit() {
|
||||
Assert.assertEquals(KeyPath.of("first.section", "second", "third"),
|
||||
deepMapper.split("first\\\\.section.second.third"));
|
||||
|
||||
Assert.assertEquals(KeyPath.of("first", "second", "third"),
|
||||
deepMapper.split("first.second.third"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonNestedConcat() {
|
||||
Assert.assertEquals("flat.map\\\\.deeper",
|
||||
flatMapper.concat(KeyPath.of("flat.map", "deeper")));
|
||||
|
||||
Assert.assertEquals("flat.map.keys",
|
||||
flatMapper.concat(KeyPath.of("flat.map.keys")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonNestedSplit() {
|
||||
Assert.assertEquals(KeyPath.of("flat.keys.with", "deep.section"),
|
||||
flatMapper.split("flat.keys.with\\\\.deep.section"));
|
||||
|
||||
Assert.assertEquals(KeyPath.of("flat.keys.only"),
|
||||
flatMapper.split("flat.keys.only"));
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
package de.marhali.easyi18n;
|
||||
|
||||
import de.marhali.easyi18n.model.translation.variant.Plural;
|
||||
import de.marhali.easyi18n.model.translation.variant.ContextMap;
|
||||
import de.marhali.easyi18n.model.translation.variant.LocaleMap;
|
||||
import de.marhali.easyi18n.model.translation.Translation;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link Translation}.
|
||||
* @author marhali
|
||||
*/
|
||||
public class TranslationTest {
|
||||
|
||||
@Test
|
||||
public void add() {
|
||||
Translation value = new Translation();
|
||||
value.set(ContextMap.DEFAULT, Plural.DEFAULT, "en", "hello");
|
||||
Assert.assertEquals(value.getValue(ContextMap.DEFAULT, Plural.DEFAULT, "en"), "hello");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void override() {
|
||||
Translation value = new Translation();
|
||||
value.set(ContextMap.DEFAULT, Plural.DEFAULT, new LocaleMap(Map.of("en", "hello", "de", "hallo")));
|
||||
value.set(ContextMap.DEFAULT, Plural.DEFAULT, "en", "new hello");
|
||||
Assert.assertEquals(value.getValue(ContextMap.DEFAULT, Plural.DEFAULT, "en"), "new hello");
|
||||
Assert.assertEquals(value.getValue(ContextMap.DEFAULT, Plural.DEFAULT, "de"), "hallo");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void plurals() {
|
||||
Translation value = new Translation();
|
||||
value.set(ContextMap.DEFAULT, Plural.ONE, "en", "boyfriend");
|
||||
value.set(ContextMap.DEFAULT, Plural.MANY, "en", "boyfriends");
|
||||
Assert.assertEquals(value.getValue(ContextMap.DEFAULT, Plural.ONE, "en"), "boyfriend");
|
||||
Assert.assertEquals(value.getValue(ContextMap.DEFAULT, Plural.MANY, "en"), "boyfriends");
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user