PatternFlattener implements Flattener, Flattener2 { static LevelFiller parseLevelParameter(String wrappedParameter, String trimmedParameter) { if (trimmedParameter.equals(PARAMETER_LEVEL_SHORT)) { return new LevelFiller(wrappedParameter, trimmedParameter, false); } else if (trimmedParameter.equals(PARAMETER_LEVEL_LONG)) { return new LevelFiller(wrappedParameter, trimmedParameter, true); } return null; } PatternFlattener(String pattern); @Override CharSequence flatten(int logLevel, String tag, String message); @Override CharSequence flatten(long timeMillis, int logLevel, String tag, String message);  }
@Test public void testParseLevelParameter() { PatternFlattener.ParameterFiller parameterFiller = PatternFlattener.parseLevelParameter("{l}", "l"); assertNoNullAndClass(parameterFiller, PatternFlattener.LevelFiller.class); assertFalse(((PatternFlattener.LevelFiller) parameterFiller).useLongName); parameterFiller = PatternFlattener.parseLevelParameter("{L}", "L"); assertNoNullAndClass(parameterFiller, PatternFlattener.LevelFiller.class); assertTrue(((PatternFlattener.LevelFiller) parameterFiller).useLongName); parameterFiller = PatternFlattener.parseDateParameter("{ll}", "ll"); assertNull(parameterFiller); }