Browse Source

Fix NLSTest and RootLocalTest for JUnit 4

These test classes needed new @Test annotations to be found by the
JUnit 4 test runner.

Change-Id: I61b6a8ebd468fa2d13fad5bf9cbd8f81a6f67e41
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
stable-0.11
Shawn O. Pearce 14 years ago
parent
commit
e026cfab38
  1. 8
      org.eclipse.jgit.test/tst/org/eclipse/jgit/nls/NLSTest.java
  2. 53
      org.eclipse.jgit.test/tst/org/eclipse/jgit/nls/RootLocaleTest.java

8
org.eclipse.jgit.test/tst/org/eclipse/jgit/nls/TestNLS.java → org.eclipse.jgit.test/tst/org/eclipse/jgit/nls/NLSTest.java

@ -51,8 +51,11 @@ import java.util.Locale;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
public class TestNLS {
import org.junit.Test;
public class NLSTest {
@Test
public void testNLSLocale() {
NLS.setLocale(NLS.ROOT_LOCALE);
GermanTranslatedBundle bundle = GermanTranslatedBundle.get();
@ -63,6 +66,7 @@ public class TestNLS {
assertEquals(Locale.GERMAN, bundle.effectiveLocale());
}
@Test
public void testJVMDefaultLocale() {
Locale.setDefault(NLS.ROOT_LOCALE);
NLS.useJVMDefaultLocale();
@ -75,6 +79,7 @@ public class TestNLS {
assertEquals(Locale.GERMAN, bundle.effectiveLocale());
}
@Test
public void testThreadTranslationBundleInheritance() throws InterruptedException {
class T extends Thread {
@ -100,6 +105,7 @@ public class TestNLS {
assertSame(mainThreadsBundle, t.bundle);
}
@Test
public void testParallelThreadsWithDifferentLocales() throws InterruptedException {
final CyclicBarrier barrier = new CyclicBarrier(2);

53
org.eclipse.jgit.test/tst/org/eclipse/jgit/stringext/TestStringExternalization.java → org.eclipse.jgit.test/tst/org/eclipse/jgit/nls/RootLocaleTest.java

@ -41,33 +41,50 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.eclipse.jgit.stringext;
package org.eclipse.jgit.nls;
import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.awtui.UIText;
import org.eclipse.jgit.console.ConsoleText;
import org.eclipse.jgit.http.server.HttpServerText;
import org.eclipse.jgit.iplog.IpLogText;
import org.eclipse.jgit.nls.NLS;
import org.eclipse.jgit.pgm.CLIText;
import org.junit.Before;
import org.junit.Test;
public class TestStringExternalization {
public class RootLocaleTest {
@Before
public void setUp() {
NLS.setLocale(NLS.ROOT_LOCALE);
}
@Test
public void testJGitText() {
NLS.getBundleFor(JGitText.class);
}
private static Class[] translationBundleClasses = new Class[] {
ConsoleText.class, HttpServerText.class, IpLogText.class, CLIText.class,
UIText.class, JGitText.class,
};
@Test
public void testHttpServerText() {
NLS.getBundleFor(HttpServerText.class);
}
/**
* Verifies that all translation keys are defined in the root resource bundle.
* <p>
* This makes sure that all translation bundles will get all strings populated
* since the string will be found at last in the root resource bundle.
*/
public void testAllTranslationKeysDefinedInRoot() {
NLS.setLocale(NLS.ROOT_LOCALE);
for (Class c : translationBundleClasses) {
NLS.getBundleFor(c);
}
@Test
public void testConsoleText() {
NLS.getBundleFor(ConsoleText.class);
}
@Test
public void testCLIText() {
NLS.getBundleFor(CLIText.class);
}
@Test
public void testUIText() {
NLS.getBundleFor(UIText.class);
}
@Test
public void testIpLogText() {
NLS.getBundleFor(IpLogText.class);
}
}
Loading…
Cancel
Save