ConvertToStringUdf implements ScalarUdf { @SamzaSqlUdfMethod(params = SamzaSqlFieldType.ANY) public String execute(Object args) { return args.toString(); }  @Override void init(Config udfConfig, Context context); @SamzaSqlUdfMethod(params = SamzaSqlFieldType.ANY) String execute(Object args);  }
@Test public void testConvertIntegerToString() { ConvertToStringUdf convertToStringUdf = new ConvertToStringUdf(); Assert.assertEquals(convertToStringUdf.execute(10), "10"); }
@Test public void testConvertLongToString() { ConvertToStringUdf convertToStringUdf = new ConvertToStringUdf(); Assert.assertEquals(convertToStringUdf.execute(10000000000L), "10000000000"); }
@Test public void testConvertDoubleToString() { ConvertToStringUdf convertToStringUdf = new ConvertToStringUdf(); Assert.assertEquals(convertToStringUdf.execute(10.0000345), "10.0000345"); }
@Test public void testConvertBooleanToString() { ConvertToStringUdf convertToStringUdf = new ConvertToStringUdf(); Assert.assertEquals(convertToStringUdf.execute(true), "true"); }
@Test public void testConvertEnumToString() { ConvertToStringUdf convertToStringUdf = new ConvertToStringUdf(); Assert.assertEquals(convertToStringUdf.execute(LightSwitch.On), "On"); }