mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-05-16 08:31:26 +00:00
undo some of the debugging changes I made
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
package io.swagger.codegen;
|
||||
|
||||
import org.reflections.Reflections;
|
||||
import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
public class CodegenConfigLoaderTest {
|
||||
|
||||
@DataProvider(name = "codegenConfig")
|
||||
public Object[][] createCodegenConfigDataSet() throws Exception {
|
||||
|
||||
Reflections reflections = new Reflections("io.swagger.codegen.languages");
|
||||
final Set<Class<? extends DefaultCodegen>> subTypesOf = reflections.getSubTypesOf(DefaultCodegen.class);
|
||||
|
||||
List<CodegenConfig> codegenConfigList = new ArrayList<CodegenConfig>();
|
||||
|
||||
for (Class<? extends DefaultCodegen> aClass : subTypesOf) {
|
||||
if (!Modifier.isAbstract(aClass.getModifiers())) {
|
||||
final DefaultCodegen defaultCodegen = aClass.newInstance();
|
||||
codegenConfigList.add((CodegenConfig) defaultCodegen);
|
||||
}
|
||||
}
|
||||
|
||||
Object[][] result = new Object[codegenConfigList.size()][1];
|
||||
|
||||
for (int i = 0; i < codegenConfigList.size(); i++) {
|
||||
result[i]= new Object[]{codegenConfigList.get(i)};
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Test(dataProvider = "codegenConfig")
|
||||
public void testLoadByName(CodegenConfig codegenConfig) throws Exception {
|
||||
final CodegenConfig loadedConfig = CodegenConfigLoader.forName(codegenConfig.getName());
|
||||
|
||||
assertEquals(loadedConfig.getClass(), codegenConfig.getClass());
|
||||
assertEquals(loadedConfig.getName(), codegenConfig.getName());
|
||||
}
|
||||
|
||||
@Test(dataProvider = "codegenConfig")
|
||||
public void testLoadByFullQualifiedName(CodegenConfig codegenConfig) throws Exception {
|
||||
final CodegenConfig loadedConfig = CodegenConfigLoader.forName(codegenConfig.getClass().getName());
|
||||
|
||||
assertEquals(loadedConfig.getClass(), codegenConfig.getClass());
|
||||
assertEquals(loadedConfig.getName(), codegenConfig.getName());
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user