PriorityUtils { public static int lerp(int x, int a, int b) { return Math.min((int) ((x - a) * (double) FEED_MAX_VALUE / (b - a)), FEED_MAX_VALUE) + FEED_SPECIAL_SHIFT; } private  PriorityUtils(); static int lerp(int x, int a, int b); static void loadThumbnail(Context context, String image, ImageView target); static final int FEED_SPECIAL_SHIFT; static final int FEED_MAX_VALUE; }
@Test public void lerp() { assertEquals(1000 + PriorityUtils.FEED_SPECIAL_SHIFT, PriorityUtils.FEED_MAX_VALUE); assertEquals(PriorityUtils.FEED_MAX_VALUE + PriorityUtils.FEED_SPECIAL_SHIFT, PriorityUtils.lerp(200, 0, 100)); assertEquals(-10 + PriorityUtils.FEED_SPECIAL_SHIFT, PriorityUtils.lerp(-1, 0, 100)); }