@Test
public void getEncoding() {

    Assert.assertNull(AppSchemaValidator.getEncoding(""));
    Assert.assertNull(AppSchemaValidator.getEncoding("<?xml version=\"1.0\"?>"));
    Assert.assertNull(AppSchemaValidator.getEncoding("<?xml version=\"1.0\"? >"));
    Assert.assertNull(AppSchemaValidator.getEncoding("<?xml version=\"1.0\"?><root/>"));
    Assert.assertEquals("UTF-8",
            AppSchemaValidator.getEncoding("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
    Assert.assertEquals("UTF-8",
            AppSchemaValidator.getEncoding("<?xml version='1.0' encoding='UTF-8'?>"));
    Assert.assertEquals("UTF-8",
            AppSchemaValidator.getEncoding("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
    Assert.assertEquals("UTF-8", AppSchemaValidator
            .getEncoding("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>"));
    Assert.assertEquals("UTF-8",
            AppSchemaValidator.getEncoding("<?xml version=\"1.0\" encoding=\"UTF-8\"?><root/>"));
}