package com.zy.asrs.utils; import org.junit.jupiter.api.Test; import java.lang.reflect.Method; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; class UtilsLocTypeNormalizationTest { @Test void normalizeLocType1_shouldKeepLowLocType() throws Exception { assertEquals(Short.valueOf((short) 1), invokeNormalizeLocType1(1)); } @Test void normalizeLocType1_shouldKeepHighLocType() throws Exception { assertEquals(Short.valueOf((short) 2), invokeNormalizeLocType1(2)); } @Test void normalizeLocType1_shouldRejectUnsupportedValue() throws Exception { assertNull(invokeNormalizeLocType1(3)); assertNull(invokeNormalizeLocType1(null)); } private Short invokeNormalizeLocType1(Integer value) throws Exception { Method method = Utils.class.getDeclaredMethod("normalizeLocType1", Integer.class); method.setAccessible(true); return (Short) method.invoke(null, value); } }