### Question:
JavaScriptUtils { public static Object convertFromJs( Object value, int type, String fieldName ) throws HopValueException { String classType = value.getClass().getName(); switch ( type ) { case IValueMeta.TYPE_NUMBER: return jsToNumber( value, classType ); case IValueMeta.TYPE_INTEGER: return jsToInteger( value, value.getClass() ); case IValueMeta.TYPE_STRING: return jsToString( value, classType ); case IValueMeta.TYPE_DATE: return jsToDate( value, classType ); case IValueMeta.TYPE_BOOLEAN: return value; case IValueMeta.TYPE_BIGNUMBER: return jsToBigNumber( value, classType ); case IValueMeta.TYPE_BINARY: { return Context.jsToJava( value, byte[].class ); } case IValueMeta.TYPE_NONE: { throw new RuntimeException( "No data output data type was specified for new field [" + fieldName + "]" ); } default: return Context.jsToJava( value, Object.class ); } }  static Object convertFromJs( Object value, int type, String fieldName ); static Number jsToNumber( Object value, String classType ); static Long jsToInteger( Object value, Class<?> clazz ); static String jsToString( Object value, String classType ); static Date jsToDate( Object value, String classType ); static BigDecimal jsToBigNumber( Object value, String classType );  }### Answer:
@Test( expected = RuntimeException.class ) public void convertFromJs_TypeNone() throws Exception { JavaScriptUtils.convertFromJs( null, IValueMeta.TYPE_NONE, "qwerty" ); }
@Test public void convertFromJs_TypeBoolean() throws Exception { Object o = new Object(); Object o2 = JavaScriptUtils.convertFromJs( o, IValueMeta.TYPE_BOOLEAN, "qwerty" ); assertEquals( o, o2 ); }
@Test public void convertFromJs_TypeBinary() throws Exception { byte[] bytes = new byte[] { 0, 1 }; Object converted = JavaScriptUtils.convertFromJs( bytes, IValueMeta.TYPE_BINARY, "qwerty" ); assertThat( converted, is( instanceOf( byte[].class ) ) ); assertArrayEquals( bytes, (byte[]) converted ); }