### Question:
LuceneLabelTokenizer implements LabelTokenizer { @Override public String[] tokenize(String label, String language) { if(label == null){ throw new IllegalArgumentException("The parsed label MUST NOT be NULL!"); } if((language == null && langConf.useWildcard()) || langConf.isLanguage(language)){ if(label.isEmpty()){ return EMPTY; } Reader reader = new StringReader(label); TokenStream tokenizer; if(charFilterFactory != null){ tokenizer = tokenizerFactory.create(charFilterFactory.create( reader)); } else { tokenizer = tokenizerFactory.create(reader); } for(TokenFilterFactory filterFactory : filterFactories){ tokenizer = filterFactory.create(tokenizer); } List<String> tokens = new ArrayList<String>(8); try { tokenizer.reset(); while(tokenizer.incrementToken()){ OffsetAttribute offset = tokenizer.addAttribute(OffsetAttribute.class); tokens.add(label.substring(offset.startOffset(), offset.endOffset())); } tokenizer.end(); } catch (IOException e) { log.error("IOException while reading from a StringReader :(",e); return null; } finally { try { if (tokenizer == null) { return null; } tokenizer.close(); } catch (IOException e) { log.error("IOException while closing a StringReader :(",e); return null; } } return tokens.toArray(new String[tokens.size()]); } else { log.trace("Language {} not configured to be supported",language); return null; } }  @Override String[] tokenize(String label, String language); static final String PROPERTY_CHAR_FILTER_FACTORY; static final String PROPERTY_TOKENIZER_FACTORY; static final String PROPERTY_TOKEN_FILTER_FACTORY; }### Answer:
@Test(expected=IllegalArgumentException.class) public void testNullLabel(){ luceneLabelTokenizer.tokenize(null, "en"); }
@Test public void testNullLanguate(){ Assert.assertNull(luceneLabelTokenizer.tokenize("test", null)); }
@Test public void testUnsupportedLanguage(){ Assert.assertNull(luceneLabelTokenizer.tokenize("test", "de")); }
@Test public void testLuceneLabelTokenizer(){ String label = "This is only a Test"; String[] expected = label.split(" "); String[] tokens = luceneLabelTokenizer.tokenize(label, "en"); Assert.assertNotNull(tokens); Assert.assertArrayEquals(expected, tokens); }
@Test public void testEmptyLabel(){ String[] tokens = luceneLabelTokenizer.tokenize("", "en"); Assert.assertNotNull(tokens); Assert.assertTrue(tokens.length == 0); }