Debian Codegraph @

src/test/java/org/jboss/modules/MODULES_377_Test.java

raw
1 /*
2 * JBoss, Home of Professional Open Source.
3 * Copyright 2020 Red Hat, Inc., and individual contributors
4 * as indicated by the @author tags.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 package org.jboss.modules;
20
21 import static org.junit.Assert.assertEquals;
22 import static org.junit.Assert.assertFalse;
23 import static org.junit.Assert.assertTrue;
24
25 import org.jboss.modules.util.Util;
26 import org.junit.Before;
27 import org.junit.Test;
28
29 import java.io.File;
30 import java.util.Iterator;
31
32 /**
33 * [MODULES-377] Getting 'IAE: moduleLoader is null' when iterating modules and module.xml contains a permissions markup
34 *
35 * @author <a href="mailto:[email protected]">Richard Opalka</a>
36 */
37 public class MODULES_377_Test extends AbstractModuleTestCase {
38 private LocalModuleFinder moduleFinder;
39 private ModuleLoader moduleLoader;
40
41 @Before
42 public void setup() throws Exception {
43 final File repoRoot = Util.getResourceFile(getClass(), "test/MODULES_377");
44 moduleFinder = new LocalModuleFinder(new File[] {repoRoot});
45 moduleLoader = new ModuleLoader(moduleFinder);
46 }
47
48 @Test
49 public void issueTest() {
50 Iterator<String> i = moduleLoader.iterateModules((String) null, true);
51 assertTrue(i.hasNext());
52 assertEquals("local.tests.module", i.next());
53 assertFalse(i.hasNext());
54 }
55
56 }