Skip to content

Commit

Permalink
Remove non-acceptable constant denominator test case from MeasureUnit…
Browse files Browse the repository at this point in the history
…Test
  • Loading branch information
younies committed Jan 21, 2025
1 parent 88a6fc1 commit 29d2069
Showing 1 changed file with 3 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1392,33 +1392,6 @@ class ConstantDenominatorTestCase {
}
}

@Test
public void TestNonAcceptableConstantDenominator() {
class NonAcceptableConstantDenominatorTestCase {
String identifier;

NonAcceptableConstantDenominatorTestCase(String identifier) {
this.identifier = identifier;
}
}

List<NonAcceptableConstantDenominatorTestCase> testCases = Arrays.asList(
new NonAcceptableConstantDenominatorTestCase("meter-and-second"),
new NonAcceptableConstantDenominatorTestCase("meter-per--20--second"),
new NonAcceptableConstantDenominatorTestCase("meter-per-1000-1e9-second"),
new NonAcceptableConstantDenominatorTestCase("meter-per-1e20-second"));

for (NonAcceptableConstantDenominatorTestCase testCase : testCases) {
try {
MeasureUnit unit = MeasureUnit.forIdentifier(testCase.identifier);
unit.getConstantDenominator();
Assert.fail("An IllegalArgumentException must be thrown");
} catch (Exception e) {
continue;
}
}
}

@Test
public void TestInvalidIdentifiers() {
final String inputs[] = {
Expand Down Expand Up @@ -1458,6 +1431,9 @@ public void TestInvalidIdentifiers() {
"kilonewton-meter-and-newton-meter",

// Invalid units because of invalid constant denominator
"meter-per--20--second",
"meter-per-1000-1e9-second",
"meter-per-1e20-second",
"per-1000",
"meter-per-1000-1000",
"meter-per-1000-second-1000-kilometer",
Expand All @@ -1466,7 +1442,6 @@ public void TestInvalidIdentifiers() {
"meter-per-1000-1000",
"meter-per-1000-second-1000-kilometer",
"per-1000-and-per-1000",

};

for (String input : inputs) {
Expand Down

0 comments on commit 29d2069

Please sign in to comment.