private void testStrategy(Strategy distanceStrategy) throws UDFArgumentException, HiveException { Distance distance = new Distance(); Object result = distance.evaluate(distanceStrategy.getName(), "hello", "hello"); Assert.assertNotNull(result); Float dist = (Float) result; Assert.assertEquals(1.0, dist, 0f); }
@Test public void testEvaluateWithStrategyNotFound() throws HiveException { Distance distance = new Distance(); try { distance.evaluate("dd", "dd", "dd"); Assert.fail(); } catch (HiveException ex) { } }
@Test public void testEvaluateWithNullValues() throws HiveException { Distance distance = new Distance(); try { distance.evaluate(null, null, null); Assert.fail(); } catch (HiveException ex) { } }