aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
diff options
context:
space:
mode:
authorSasa Zivkov <sasa.zivkov@sap.com>2010-05-19 16:59:28 +0200
committerShawn O. Pearce <spearce@spearce.org>2010-05-19 14:37:16 -0700
commitf3d8a8ecad614906a2c4ec0077cdb24129da6c6d (patch)
tree34d041692beff0f392c27869f49b76c0fc2053e6 /org.eclipse.jgit.test/tst
parent2e961989e42b1fe7e8bd9eaa7a3d2e88a0d1d001 (diff)
downloadjgit-f3d8a8ecad614906a2c4ec0077cdb24129da6c6d.tar.gz
jgit-f3d8a8ecad614906a2c4ec0077cdb24129da6c6d.zip
Externalize strings from JGit
The strings are externalized into the root resource bundles. The resource bundles are stored under the new "resources" source folder to get proper maven build. Strings from tests are, in general, not externalized. Only in cases where it was necessary to make the test pass the strings were externalized. This was typically necessary in cases where e.getMessage() was used in assert and the exception message was slightly changed due to reuse of the externalized strings. Change-Id: Ic0f29c80b9a54fcec8320d8539a3e112852a1f7b Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java5
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/nls/TestNLS.java12
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/nls/TestTranslationBundle.java10
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchCcErrorTest.java7
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java5
5 files changed, 23 insertions, 16 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java
index 2e470b386b..387a381893 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java
@@ -44,8 +44,11 @@
package org.eclipse.jgit.lib;
+import java.text.MessageFormat;
+
import junit.framework.TestCase;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.CorruptObjectException;
public class ObjectCheckerTest extends TestCase {
@@ -62,7 +65,7 @@ public class ObjectCheckerTest extends TestCase {
fail("Did not throw CorruptObjectException");
} catch (CorruptObjectException e) {
final String m = e.getMessage();
- assertEquals("Invalid object type: " + Constants.OBJ_BAD, m);
+ assertEquals(MessageFormat.format(JGitText.get().corruptObjectInvalidType2, Constants.OBJ_BAD), m);
}
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/nls/TestNLS.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/nls/TestNLS.java
index a01ed4e923..8b02f2f5e9 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/nls/TestNLS.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/nls/TestNLS.java
@@ -55,23 +55,23 @@ public class TestNLS extends TestCase {
public void testNLSLocale() {
NLS.setLocale(NLS.ROOT_LOCALE);
GermanTranslatedBundle bundle = GermanTranslatedBundle.get();
- assertEquals(NLS.ROOT_LOCALE, bundle.getEffectiveLocale());
+ assertEquals(NLS.ROOT_LOCALE, bundle.effectiveLocale());
NLS.setLocale(Locale.GERMAN);
bundle = GermanTranslatedBundle.get();
- assertEquals(Locale.GERMAN, bundle.getEffectiveLocale());
+ assertEquals(Locale.GERMAN, bundle.effectiveLocale());
}
public void testJVMDefaultLocale() {
Locale.setDefault(NLS.ROOT_LOCALE);
NLS.useJVMDefaultLocale();
GermanTranslatedBundle bundle = GermanTranslatedBundle.get();
- assertEquals(NLS.ROOT_LOCALE, bundle.getEffectiveLocale());
+ assertEquals(NLS.ROOT_LOCALE, bundle.effectiveLocale());
Locale.setDefault(Locale.GERMAN);
NLS.useJVMDefaultLocale();
bundle = GermanTranslatedBundle.get();
- assertEquals(Locale.GERMAN, bundle.getEffectiveLocale());
+ assertEquals(Locale.GERMAN, bundle.effectiveLocale());
}
public void testThreadTranslationBundleInheritance() throws InterruptedException {
@@ -135,7 +135,7 @@ public class TestNLS extends TestCase {
assertNull("t1 was interrupted or barrier was broken", t1.e);
assertNull("t2 was interrupted or barrier was broken", t2.e);
- assertEquals(NLS.ROOT_LOCALE, t1.bundle.getEffectiveLocale());
- assertEquals(Locale.GERMAN, t2.bundle.getEffectiveLocale());
+ assertEquals(NLS.ROOT_LOCALE, t1.bundle.effectiveLocale());
+ assertEquals(Locale.GERMAN, t2.bundle.effectiveLocale());
}
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/nls/TestTranslationBundle.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/nls/TestTranslationBundle.java
index 7d713f2c1a..0b21bdbe0a 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/nls/TestTranslationBundle.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/nls/TestTranslationBundle.java
@@ -79,15 +79,15 @@ public class TestTranslationBundle extends TestCase {
NonTranslatedBundle bundle = new NonTranslatedBundle();
bundle.load(NLS.ROOT_LOCALE);
- assertEquals(NLS.ROOT_LOCALE, bundle.getEffectiveLocale());
+ assertEquals(NLS.ROOT_LOCALE, bundle.effectiveLocale());
assertEquals("Good morning {0}", bundle.goodMorning);
bundle.load(Locale.ENGLISH);
- assertEquals(NLS.ROOT_LOCALE, bundle.getEffectiveLocale());
+ assertEquals(NLS.ROOT_LOCALE, bundle.effectiveLocale());
assertEquals("Good morning {0}", bundle.goodMorning);
bundle.load(Locale.GERMAN);
- assertEquals(NLS.ROOT_LOCALE, bundle.getEffectiveLocale());
+ assertEquals(NLS.ROOT_LOCALE, bundle.effectiveLocale());
assertEquals("Good morning {0}", bundle.goodMorning);
}
@@ -95,11 +95,11 @@ public class TestTranslationBundle extends TestCase {
GermanTranslatedBundle bundle = new GermanTranslatedBundle();
bundle.load(NLS.ROOT_LOCALE);
- assertEquals(NLS.ROOT_LOCALE, bundle.getEffectiveLocale());
+ assertEquals(NLS.ROOT_LOCALE, bundle.effectiveLocale());
assertEquals("Good morning {0}", bundle.goodMorning);
bundle.load(Locale.GERMAN);
- assertEquals(Locale.GERMAN, bundle.getEffectiveLocale());
+ assertEquals(Locale.GERMAN, bundle.effectiveLocale());
assertEquals("Guten Morgen {0}", bundle.goodMorning);
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchCcErrorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchCcErrorTest.java
index f2bae6eb19..87bd9d386d 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchCcErrorTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/PatchCcErrorTest.java
@@ -45,6 +45,9 @@ package org.eclipse.jgit.patch;
import java.io.IOException;
import java.io.InputStream;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.JGitText;
import junit.framework.TestCase;
@@ -57,7 +60,7 @@ public class PatchCcErrorTest extends TestCase {
final FormatError e = p.getErrors().get(0);
assertSame(FormatError.Severity.ERROR, e.getSeverity());
assertEquals(
- "Truncated hunk, at least 1 lines is missing for ancestor 1",
+ MessageFormat.format(JGitText.get().truncatedHunkLinesMissingForAncestor, 1, 1),
e.getMessage());
assertEquals(346, e.getOffset());
assertTrue(e.getLineText().startsWith(
@@ -67,7 +70,7 @@ public class PatchCcErrorTest extends TestCase {
final FormatError e = p.getErrors().get(1);
assertSame(FormatError.Severity.ERROR, e.getSeverity());
assertEquals(
- "Truncated hunk, at least 2 lines is missing for ancestor 2",
+ MessageFormat.format(JGitText.get().truncatedHunkLinesMissingForAncestor, 2, 2),
e.getMessage());
assertEquals(346, e.getOffset());
assertTrue(e.getLineText().startsWith(
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java
index 61c894e414..156e4d0230 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java
@@ -53,9 +53,11 @@ import static org.eclipse.jgit.transport.SideBandOutputStream.SMALL_BUF;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
+import java.text.MessageFormat;
import junit.framework.TestCase;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.lib.Constants;
// Note, test vectors created with:
@@ -221,8 +223,7 @@ public class SideBandOutputStreamTest extends TestCase {
new SideBandOutputStream(CH_DATA, Integer.MAX_VALUE, rawOut);
fail("Accepted " + Integer.MAX_VALUE + " for buffer size");
} catch (IllegalArgumentException e) {
- assertEquals("packet size " + Integer.MAX_VALUE
- + " must be <= 65520", e.getMessage());
+ assertEquals(MessageFormat.format(JGitText.get().packetSizeMustBeAtMost, Integer.MAX_VALUE, 65520), e.getMessage());
}
}