@Test public void testSetFallbackNotAllowed() { Logger logger = Logger.getLogger(EnvFunction.class.getName()); Formatter formatter = new SimpleFormatter(); ByteArrayOutputStream out = new ByteArrayOutputStream(); Handler handler = new StreamHandler(out, formatter); logger.addHandler(handler); try { EnvFunction function = new EnvFunction(); function.setFallbackValue(ff.literal(0)); handler.flush(); String logMsg = out.toString(); assertNotNull(logMsg); assertTrue(logMsg.toLowerCase().contains("setfallbackvalue")); } finally { logger.removeHandler(handler); } }
@Override public void setFallbackValue(Literal fallback) { Logger logger = Logger.getLogger(EnvFunction.class.getName()); logger.log(Level.WARNING, "The setFallbackValue is not supported by this function." + "Use a second argument when calling the function to provide " + "a default value."); }
EnvFunction extends FunctionExpressionImpl { @Override public void setFallbackValue(Literal fallback) { Logger logger = Logger.getLogger(EnvFunction.class.getName()); logger.log(Level.WARNING, "The setFallbackValue is not supported by this function." + "Use a second argument when calling the function to provide " + "a default value."); } }
EnvFunction extends FunctionExpressionImpl { @Override public void setFallbackValue(Literal fallback) { Logger logger = Logger.getLogger(EnvFunction.class.getName()); logger.log(Level.WARNING, "The setFallbackValue is not supported by this function." + "Use a second argument when calling the function to provide " + "a default value."); } EnvFunction(); }
EnvFunction extends FunctionExpressionImpl { @Override public void setFallbackValue(Literal fallback) { Logger logger = Logger.getLogger(EnvFunction.class.getName()); logger.log(Level.WARNING, "The setFallbackValue is not supported by this function." + "Use a second argument when calling the function to provide " + "a default value."); } EnvFunction(); static void setLocalValues(Map<String, Object> values); static void clearLocalValues(); static void setGlobalValues(Map<String, Object> values); static void clearGlobalValues(); static void setLocalValue(String name, Object value); static void setGlobalValue(String name, Object value); @Override int getArgCount(); @Override Object evaluate(Object feature); @Override void setParameters(List params); @Override void setFallbackValue(Literal fallback); }
EnvFunction extends FunctionExpressionImpl { @Override public void setFallbackValue(Literal fallback) { Logger logger = Logger.getLogger(EnvFunction.class.getName()); logger.log(Level.WARNING, "The setFallbackValue is not supported by this function." + "Use a second argument when calling the function to provide " + "a default value."); } EnvFunction(); static void setLocalValues(Map<String, Object> values); static void clearLocalValues(); static void setGlobalValues(Map<String, Object> values); static void clearGlobalValues(); static void setLocalValue(String name, Object value); static void setGlobalValue(String name, Object value); @Override int getArgCount(); @Override Object evaluate(Object feature); @Override void setParameters(List params); @Override void setFallbackValue(Literal fallback); static FunctionName NAME; }