### Question:
LabelSelector extends ExpressionSelector implements Selector { public static Set<String> parseExpression(String expression) throws NacosException { return ExpressionInterpreter.parseExpression(expression); } LabelSelector(); Set<String> getLabels(); void setLabels(Set<String> labels); static Set<String> parseExpression(String expression); @Override List<Instance> select(String consumer, List<Instance> providers);  }### Answer:
@Test public void parseExpression() throws NacosException { expression = StringUtils.deleteWhitespace(expression); List<String> terms = LabelSelector.ExpressionInterpreter.getTerms(expression); Assert.assertEquals(7, terms.size()); Set<String> parseLables = LabelSelector.parseExpression(expression); Assert.assertEquals(2, parseLables.size()); String[] labs = parseLables.toArray(new String[] {}); Assert.assertEquals("A", labs[0]); Assert.assertEquals("B", labs[1]); }
@Test public void parseExpression() throws NacosException { expression = StringUtils.deleteWhitespace(expression); List<String> terms =LabelSelector.ExpressionInterpreter.getTerms(expression); Assert.assertEquals(7,terms.size()); Set<String> parseLables=LabelSelector.parseExpression(expression); Assert.assertEquals(2,parseLables.size()); String[] labs=parseLables.toArray(new String[]{}); Assert.assertEquals("A",labs[0]); Assert.assertEquals("B",labs[1]); }