@Test public void testGetAsString2() { LongConverter converter = new LongConverter(); FacesContext facesContext = PowerMock.createMock(FacesContext.class); replay(facesContext); assertEquals("", converter.getAsString(facesContext, new UIPanel(), null)); verify(facesContext); }
@Override public String getAsString(FacesContext context, UIComponent component, Object value) { if (context == null || component == null) { throw new NullPointerException(); } if (value == null) { return ""; } if (value instanceof String) { return (String) value; } try { return (Long.toString(((Number) value).longValue())); } catch (Exception e) { throw new ConverterException(MessageFactory.getMessage( context, STRING_ID, value, MessageFactory.getLabel(context, component)), e); } }
LongConverter implements Converter { @Override public String getAsString(FacesContext context, UIComponent component, Object value) { if (context == null || component == null) { throw new NullPointerException(); } if (value == null) { return ""; } if (value instanceof String) { return (String) value; } try { return (Long.toString(((Number) value).longValue())); } catch (Exception e) { throw new ConverterException(MessageFactory.getMessage( context, STRING_ID, value, MessageFactory.getLabel(context, component)), e); } } }
LongConverter implements Converter { @Override public String getAsString(FacesContext context, UIComponent component, Object value) { if (context == null || component == null) { throw new NullPointerException(); } if (value == null) { return ""; } if (value instanceof String) { return (String) value; } try { return (Long.toString(((Number) value).longValue())); } catch (Exception e) { throw new ConverterException(MessageFactory.getMessage( context, STRING_ID, value, MessageFactory.getLabel(context, component)), e); } }  }
LongConverter implements Converter { @Override public String getAsString(FacesContext context, UIComponent component, Object value) { if (context == null || component == null) { throw new NullPointerException(); } if (value == null) { return ""; } if (value instanceof String) { return (String) value; } try { return (Long.toString(((Number) value).longValue())); } catch (Exception e) { throw new ConverterException(MessageFactory.getMessage( context, STRING_ID, value, MessageFactory.getLabel(context, component)), e); } }  @Override Object getAsObject(FacesContext context, UIComponent component,
                              String value); @Override String getAsString(FacesContext context, UIComponent component,
                              Object value); }
LongConverter implements Converter { @Override public String getAsString(FacesContext context, UIComponent component, Object value) { if (context == null || component == null) { throw new NullPointerException(); } if (value == null) { return ""; } if (value instanceof String) { return (String) value; } try { return (Long.toString(((Number) value).longValue())); } catch (Exception e) { throw new ConverterException(MessageFactory.getMessage( context, STRING_ID, value, MessageFactory.getLabel(context, component)), e); } }  @Override Object getAsObject(FacesContext context, UIComponent component,
                              String value); @Override String getAsString(FacesContext context, UIComponent component,
                              Object value); static final String CONVERTER_ID; static final String LONG_ID; static final String STRING_ID; }