Skip to content

Commit

Permalink
# WARNING: head commit changed in the meantime
Browse files Browse the repository at this point in the history
98: Update JUnit

Task-Url: unitsofmeasurement/uom-demos#98
  • Loading branch information
keilw committed Oct 25, 2020
1 parent 27aa203 commit 1f6aa14
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions src/test/java/tech/units/indriya/unit/UnitsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,15 @@

import javax.measure.Dimension;
import javax.measure.Unit;
import javax.measure.quantity.Length;
import javax.measure.quantity.Time;
import javax.measure.quantity.Volume;
import javax.measure.spi.SystemOfUnits;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import tech.units.indriya.unit.UnitDimension;
import tech.units.indriya.unit.Units;

import static org.junit.jupiter.api.Assertions.*;
import static tech.units.indriya.unit.Units.*;

Expand Down Expand Up @@ -84,6 +83,35 @@ public void testByClassTime() {
assertNotNull(result);
assertEquals("s", result.toString());
}

@Test
public void testByClassLength() {
Unit<?> result = sou.getUnit(Length.class);
assertNotNull(result);
assertEquals("m", result.toString());
}

@Test
public void testByClassAndDimensionLength() {
Unit<?> result = sou.getUnit(Length.class);
assertNotNull(result);
Dimension dim = result.getDimension();
assertNotNull(dim);
assertEquals(UnitDimension.LENGTH, dim);
testGetByDimension(dim, 1);
}

@Test
public void testByClassAndDimensionVolume() {
Unit<?> result = sou.getUnit(Volume.class);
assertNotNull(result);
Dimension dim = result.getDimension();
assertNotNull(dim);
assertEquals(UnitDimension.LENGTH.multiply(UnitDimension.LENGTH)
.multiply(UnitDimension.LENGTH), dim);
testGetByDimension(dim, 2);
assertEquals(1, dim.getBaseDimensions().size());
}

@Test
public void testByStringM() {
Expand Down

0 comments on commit 1f6aa14

Please sign in to comment.