### Question:
Utils { public static float shortestRotation(float heading, float previousHeading) { double diff = previousHeading - heading; if (diff > 180.0f) { heading += 360.0f; } else if (diff < -180.0f) { heading -= 360.f; } return heading; } private  Utils(); static float shortestRotation(float heading, float previousHeading); static float normalize(float angle);  }### Answer:
@Test public void shortestRotation_doesReturnValueDistanceQuickestToZero() throws Exception { float value = Utils.shortestRotation(0, 181); assertEquals(360f, value); value = Utils.shortestRotation(0, 179); assertEquals(0f, value); value = Utils.shortestRotation(0, 180); assertEquals(0f, value); }
@Test public void shortestRotation_doesReturnValueDistanceQuickestToFifty() throws Exception { float value = Utils.shortestRotation(50, 231); assertEquals(410f, value); value = Utils.shortestRotation(50, 229); assertEquals(50f, value); value = Utils.shortestRotation(50, 180); assertEquals(50f, value); }