@Before
public void setup() throws Exception {
MockitoAnnotations.initMocks(this);
final List<VanityPathConfig> configs = new ArrayList<MapConfigurationProvider.VanityPathConfig>();
configs.add(new VanityPathConfig("/libs/", false));
configs.add(new VanityPathConfig("/libs/denied", true));
configs.add(new VanityPathConfig("/foo/", false));
configs.add(new VanityPathConfig("/baa/", false));
configs.add(new VanityPathConfig("/justVanityPath", false));
configs.add(new VanityPathConfig("/justVanityPath2", false));
configs.add(new VanityPathConfig("/badVanityPath", false));
configs.add(new VanityPathConfig("/redirectingVanityPath", false));
configs.add(new VanityPathConfig("/redirectingVanityPath301", false));
configs.add(new VanityPathConfig("/vanityPathOnJcrContent", false));
Collections.sort(configs);
when(resourceResolverFactory.getAdministrativeResourceResolver(null)).thenReturn(resourceResolver);
when(resourceResolverFactory.isVanityPathEnabled()).thenReturn(true);
when(resourceResolverFactory.getVanityPathConfig()).thenReturn(configs);