feat: add temperature unit conversions (#5315)

Co-authored-by: Bama Charan Chhandogi <b.c.chhandogi@gmail.com>
This commit is contained in:
Piotr Idzik
2024-08-22 08:43:52 +02:00
committed by GitHub
parent 5149051e95
commit 07dbc51e1b
5 changed files with 189 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
package com.thealgorithms.conversions;
import static java.util.Map.entry;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Map;
import org.apache.commons.lang3.tuple.Pair;
import org.junit.jupiter.api.Test;
public class UnitsConverterTest {
@Test
void testConvertThrowsForSameUnits() {
final UnitsConverter someConverter = new UnitsConverter(Map.ofEntries(entry(Pair.of("A", "B"), new AffineConverter(10.0, -20.0))));
assertThrows(IllegalArgumentException.class, () -> someConverter.convert("A", "A", 20.0));
assertThrows(IllegalArgumentException.class, () -> someConverter.convert("B", "B", 20.0));
}
}