Skip to content

Commit

Permalink
CLDR-15029 Rename unittest.TestUtilities to unittest.TestHelper (#4035)
Browse files Browse the repository at this point in the history
  • Loading branch information
btangmu authored and conradarcturus committed Sep 25, 2024
1 parent 901cff3 commit 99cd74c
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public TestUserRegistry() {
/**
* Test the ability of a user to change another user's level, especially the aspects of
* canSetUserLevel that depend on org.unicode.cldr.web.UserRegistry for info that isn't
* available to org.unicode.cldr.unittest.TestUtilities.TestCanCreateOrSetLevelTo()
* available to org.unicode.cldr.unittest.TestHelper.TestCanCreateOrSetLevelTo()
*
* @throws SQLException
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
Note: this test assumes and requires that the .../minimumGroupingDigits path
is "contributed" in fr.xml, and that the .../decimal path is "approved" in fr.xml.
Ideally this test might mock the data to avoid the assumption.
Compare TestUtilities.TestVoteResolver where it is possible to set oldStatus, etc. -->
Compare TestHelper.TestVoteResolver where it is possible to set oldStatus, etc. -->

<user name="TwenA" org="apple" level="vetter" locales="*"/>
<user name="TwenB" org="ibm" level="vetter" locales="*"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public TestAll() {
"org.unicode.cldr.unittest.TestScriptMetadata",
"org.unicode.cldr.unittest.TestSupplementalInfo",
"org.unicode.cldr.unittest.TestTransforms",
"org.unicode.cldr.unittest.TestUtilities",
"org.unicode.cldr.unittest.TestHelper",
"org.unicode.cldr.unittest.TestCLDRLocaleCoverage",
"org.unicode.cldr.unittest.TestDayPeriods",
"org.unicode.cldr.unittest.TestSubdivisions",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
package org.unicode.cldr.unittest;
/*
* TODO: rename this file and class to avoid confusion with org.unicode.cldr.util TestUtilities.java
* When Eclipse console shows an error such as
* Error: (TestUtilities.java:1154) : 8 value: expected "old-value", got null
* the link wrongly opens the wrong file named TestUtilities.java. The two files are:
* cldr/tools/cldr-code/src/main/java/org/unicode/cldr/util/TestUtilities.java
* cldr/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestUtilities.java
*/

import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Ordering;
Expand Down Expand Up @@ -47,7 +39,7 @@
import org.unicode.cldr.util.VoteResolver.VoterInfo;
import org.unicode.cldr.util.props.ICUPropertyFactory;

public class TestUtilities extends TestFmwkPlus {
public class TestHelper extends TestFmwkPlus {
public static boolean DEBUG = true;

private static final UnicodeSet DIGITS = new UnicodeSet("[0-9]");
Expand All @@ -60,7 +52,7 @@ public class TestUtilities extends TestFmwkPlus {
final int TWO_VETTER_BAR = VoteResolver.LOWER_BAR;

public static void main(String[] args) {
new TestUtilities().run(args);
new TestHelper().run(args);
}

public void TestPluralSamples() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
import java.util.Map.Entry;
import org.junit.jupiter.api.Test;
import org.unicode.cldr.test.OutdatedPaths;
import org.unicode.cldr.unittest.TestHelper;
import org.unicode.cldr.util.PathHeader.PageId;
import org.unicode.cldr.util.PathHeader.SectionId;
import org.unicode.cldr.util.VoteResolver.VoteStatus;

/** Also see {@link org.unicode.cldr.unittest.TestUtilities} */
/** Also see {@link TestHelper} */
class TestVettingViewer {
@Test
void testDashboardEnglishChanged() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.unicode.cldr.unittest.TestUtilities;
import org.unicode.cldr.unittest.TestHelper;
import org.unicode.cldr.util.VoteResolver.Status;

/**
* @see org.unicode.cldr.unittest.TestUtilities
* @see org.unicode.cldr.unittest.TestUtilities#TestUser
* @see TestHelper
* @see TestHelper#TestUser
*/
public class TestVoteResolver {

Expand All @@ -34,11 +34,11 @@ void testDisputed() {
assertTrue(t0.before(t1));

// Vote with a date in the past, this will lose the org dispute
vr.add("Bouvet", TestUtilities.TestUser.googleV.voterId, null, t0);
vr.add("Bouvet", TestHelper.TestUser.googleV.voterId, null, t0);

vr.add("Illa Bouvet", TestUtilities.TestUser.googleV2.voterId, null, t1);
vr.add("Illa Bouvet", TestUtilities.TestUser.appleV.voterId, null, t1);
vr.add("Illa Bouvet", TestUtilities.TestUser.unaffiliatedS.voterId, null, t1);
vr.add("Illa Bouvet", TestHelper.TestUser.googleV2.voterId, null, t1);
vr.add("Illa Bouvet", TestHelper.TestUser.appleV.voterId, null, t1);
vr.add("Illa Bouvet", TestHelper.TestUser.unaffiliatedS.voterId, null, t1);
assertAll(
"Verify the outcome",
() -> assertEquals("Illa Bouvet", vr.getWinningValue()),
Expand All @@ -60,10 +60,10 @@ public void testPerf(boolean doGet) {
CLDRLocale.getInstance("fr"), null); // NB: pathHeader is needed for annotations
vr.setBaseline("bafut", Status.unconfirmed);
vr.setBaileyValue("bfd");
vr.add("bambara", TestUtilities.TestUser.appleV.voterId);
vr.add("bafia", TestUtilities.TestUser.googleV.voterId);
vr.add("bassa", TestUtilities.TestUser.googleV2.voterId);
vr.add("bafut", TestUtilities.TestUser.unaffiliatedS.voterId);
vr.add("bambara", TestHelper.TestUser.appleV.voterId);
vr.add("bafia", TestHelper.TestUser.googleV.voterId);
vr.add("bassa", TestHelper.TestUser.googleV2.voterId);
vr.add("bafut", TestHelper.TestUser.unaffiliatedS.voterId);

assertAll(
"Verify the outcome",
Expand All @@ -88,10 +88,10 @@ void testExplanations() {
CLDRLocale.getInstance("fr"), null); // NB: pathHeader is needed for annotations
vr.setBaseline("bafut", Status.unconfirmed);
vr.setBaileyValue("bfd");
vr.add("bambara", TestUtilities.TestUser.appleV.voterId);
vr.add("bafia", TestUtilities.TestUser.googleV.voterId);
vr.add("bassa", TestUtilities.TestUser.googleV2.voterId);
vr.add("bafut", TestUtilities.TestUser.unaffiliatedS.voterId);
vr.add("bambara", TestHelper.TestUser.appleV.voterId);
vr.add("bafia", TestHelper.TestUser.googleV.voterId);
vr.add("bassa", TestHelper.TestUser.googleV2.voterId);
vr.add("bafut", TestHelper.TestUser.unaffiliatedS.voterId);

vr.enableTranscript(); // Should be recalculated from here.
assertAll(
Expand All @@ -107,7 +107,7 @@ void testExplanations() {
}

private VoteResolver<String> getStringResolver() {
return new VoteResolver<String>(TestUtilities.getTestVoterInfoList());
return new VoteResolver<String>(TestHelper.getTestVoterInfoList());
}

/**
Expand Down

0 comments on commit 99cd74c

Please sign in to comment.