Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
NeqModPlus
de.hft-stuttgart.cityunits
Commits
16bf726b
Commit
16bf726b
authored
4 years ago
by
Kai-Holger Brassel
Browse files
Options
Download
Email Patches
Plain Diff
Workaround for obscure error when compiling tests
parent
93e29e25
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
de.hft-stuttgart.cityunits.tests/src/de/hftstuttgart/cityunits/tests/QuantityTest.java
+5
-7
...sts/src/de/hftstuttgart/cityunits/tests/QuantityTest.java
with
5 additions
and
7 deletions
+5
-7
de.hft-stuttgart.cityunits.tests/src/de/hftstuttgart/cityunits/tests/QuantityTest.java
+
5
-
7
View file @
16bf726b
...
...
@@ -12,7 +12,7 @@ import de.hftstuttgart.cityunits.model.UrbanSimulationUnits;
import
tech.units.indriya.quantity.Quantities
;
import
tech.units.indriya.unit.Units
;
// Quantities.getQuantity("1.50 €"); does not compile in Maven without cast to String ???
class
QuantityTest
{
@BeforeAll
...
...
@@ -23,8 +23,7 @@ class QuantityTest
@Test
void
testTemperature
()
{
java
.
lang
.
String
cs
=
"5 °C"
;
Quantity
<?>
q
=
Quantities
.
getQuantity
(
cs
);
Quantity
<?>
q
=
Quantities
.
getQuantity
((
String
)
"5 °C"
);
assertEquals
(
"[Θ]"
,
q
.
getUnit
().
getDimension
().
toString
(),
"Wrong dimension!"
);
assertEquals
(
"278.15 K"
,
q
.
toSystemUnit
().
toString
(),
"Wrong calculation of Celsius to Kelvin!"
);
...
...
@@ -42,14 +41,13 @@ class QuantityTest
@Test
void
testUrbanSimulationUnitMoney
()
{
Quantity
<?>
cost
=
Quantities
.
getQuantity
(
"1.50 €"
);
Quantity
<?>
cost
=
Quantities
.
getQuantity
(
(
String
)
"1.50 €"
);
assertEquals
(
cost
.
getUnit
(),
UrbanSimulationUnits
.
EURO
,
"Wrong currency!"
);
}
@Test
void
testUrbanSimulationUnitPPMAndTon
()
{
Quantity
<?>
q
=
Quantities
.
getQuantity
(
"20 ppm"
).
multiply
(
Quantities
.
getQuantity
(
"10 t"
));
Quantity
<?>
q
=
Quantities
.
getQuantity
((
String
)
"20 ppm"
).
multiply
(
Quantities
.
getQuantity
((
String
)
"10 t"
));
assertEquals
(
"[M]"
,
q
.
getUnit
().
getDimension
().
toString
());
assertEquals
(
UrbanSimulationUnits
.
PARTS_PER_MILLION
.
multiply
(
UrbanSimulationUnits
.
TON
),
q
.
getUnit
());
assertEquals
(
200
,
q
.
getValue
());
...
...
@@ -57,7 +55,7 @@ class QuantityTest
@Test
void
testkWhPerCubicMeter
()
{
Quantity
<?>
q
=
Quantities
.
getQuantity
(
"5.2 kW*h/m³"
);
Quantity
<?>
q
=
Quantities
.
getQuantity
(
(
String
)
"5.2 kW*h/m³"
);
assertEquals
(
"[M]/([L]·[T]²)"
,
q
.
getUnit
().
getDimension
().
toString
(),
"Wrong dimension!"
);
assertEquals
(
"187200000 W·s/m³"
,
q
.
toSystemUnit
().
toString
());
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment