Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

LPS-25358 additional unittest

  • Loading branch information...
commit 75bbaf47eadb8e1a37d5c2c07720544768949eca 1 parent ffa28e5
authored February 06, 2012
58  portal-impl/test/com/liferay/portal/language/LanguageResourcesTest.java
... ...
@@ -0,0 +1,58 @@
  1
+package com.liferay.portal.language;
  2
+
  3
+import junit.framework.TestCase;
  4
+
  5
+public class LanguageResourcesTest extends TestCase {
  6
+
  7
+	public void testAutomaticCopyFixValue() {
  8
+		assertEquals("test",LanguageResources.fixValue("test (Automatic Copy)"));
  9
+	}
  10
+	
  11
+	public void testMistypedAutomaticCopyFixValue() {
  12
+		assertUnchanged("Missing Space(Automatic Copy)");
  13
+		assertUnchanged("Space in annotation ( Automatic Copy)");
  14
+		assertUnchanged("Space in annotation (Automatic Copy )");
  15
+		assertUnchanged("Spaces in annotation ( Automatic Copy)");
  16
+		assertUnchanged("Trailing Space (Automatic Copy) ");
  17
+		assertUnchanged("(Automatic Copy) has to be at end");
  18
+	}
  19
+	
  20
+	public void testAutomaticTranslationFixValue() {
  21
+		assertEquals("test",LanguageResources.fixValue("test (Automatic Translation)"));
  22
+	}
  23
+	
  24
+	
  25
+	public void testMistypedAutomaticTranslationFixValue() {
  26
+		assertUnchanged("Missing Space(Automatic Translation)");
  27
+		assertUnchanged("Space in annotation ( Automatic Translation)");
  28
+		assertUnchanged("Space in annotation (Automatic Translation )");
  29
+		assertUnchanged("Spaces in annotation ( Automatic Translation )");
  30
+		assertUnchanged("Trailing Space (Automatic Translation) ");
  31
+		assertUnchanged("(Automatic Translation) has to be at end");
  32
+	}
  33
+
  34
+	public void testNopFixValue() {
  35
+		assertUnchanged("test");
  36
+		assertUnchanged("test (Unknown annotation)");
  37
+		assertUnchanged("test");
  38
+	}
  39
+	
  40
+	public void testFixValueForQuestionableTranslations() {
  41
+		assertEquals("test",LanguageResources.fixValue("test (Questionable Translation)"));
  42
+		assertEquals("test",LanguageResources.fixValue("test (Questionable Translation: can be annotated)"));
  43
+		assertEquals("test",LanguageResources.fixValue("test (Questionable Translation also works without colon)"));
  44
+		assertEquals("does not require closing brace",
  45
+				LanguageResources.fixValue("does not require closing brace (Questionable Translation"));
  46
+		assertEquals("does not require closing brace",
  47
+				LanguageResources.fixValue("does not require closing brace (Questionable Translation   "));
  48
+		assertEquals("Will ignore everything after the annotation",
  49
+				LanguageResources.fixValue("Will ignore everything after the annotation (Questionable Translation) " +
  50
+						"because we don't expect it to be in the middle of a translated value"));
  51
+
  52
+		assertUnchanged("Requires Leading Space(Questionable Translation)");
  53
+	}
  54
+
  55
+	private void assertUnchanged(String value) {
  56
+		assertEquals(value, LanguageResources.fixValue(value));
  57
+	}
  58
+}

0 notes on commit 75bbaf4

Please sign in to comment.
Something went wrong with that request. Please try again.