### Question:
ClassGenerationAction { private File fileForSuperclass() throws Exception { String packageName = (String) context.get(Artifact.SUPER_PACKAGE_KEY); String className = (String) context.get(Artifact.SUPER_CLASS_KEY); String filename = StringUtils.getInstance().replaceWildcardInStringWithString(WILDCARD, cgenConfiguration.getOutputPattern(), className); File dest = new File(mkpath(new File(cgenConfiguration.buildPath().toString()), packageName), filename); if (dest.exists() && !fileNeedUpdate(dest, cgenConfiguration.getSuperTemplate())) { return null; } return dest; } ClassGenerationAction(CgenConfiguration cgenConfig); String defaultTemplateName(TemplateType type); String customTemplateName(TemplateType type); void resetContextForArtifact(Artifact artifact); void addEntities(Collection<ObjEntity> entities); void addEmbeddables(Collection<Embeddable> embeddables); void addQueries(Collection<QueryDescriptor> queries); void prepareArtifacts(); void execute(); void setLogger(Logger logger); CgenConfiguration getCgenConfiguration(); void setContext(Context context); void setCgenConfiguration(CgenConfiguration cgenConfiguration); ToolsUtilsFactory getUtilsFactory(); void setUtilsFactory(ToolsUtilsFactory utilsFactory); void setMetadataUtils(MetadataUtils metadataUtils); MetadataUtils getMetadataUtils(); static final String SINGLE_CLASS_TEMPLATE; static final String SUBCLASS_TEMPLATE; static final String SUPERCLASS_TEMPLATE; static final String EMBEDDABLE_SINGLE_CLASS_TEMPLATE; static final String EMBEDDABLE_SUBCLASS_TEMPLATE; static final String EMBEDDABLE_SUPERCLASS_TEMPLATE; static final String DATAMAP_SINGLE_CLASS_TEMPLATE; static final String DATAMAP_SUBCLASS_TEMPLATE; static final String DATAMAP_SUPERCLASS_TEMPLATE; static final String SUPERCLASS_PREFIX; }### Answer:
@Test public void testFileForSuperclass() throws Exception { TemplateType templateType = TemplateType.DATAMAP_SUPERCLASS; cgenConfiguration.setRootPath(tempFolder.getRoot().toPath()); cgenConfiguration.setRelPath("."); action = new ClassGenerationAction(cgenConfiguration); ObjEntity testEntity1 = new ObjEntity("TEST"); testEntity1.setClassName("TestClass1"); action.context.put(Artifact.SUPER_PACKAGE_KEY, ""); action.context.put(Artifact.SUPER_CLASS_KEY, "TestClass1"); File outFile = new File(tempFolder.getRoot() + "/TestClass1.java"); assertFalse(outFile.exists()); action.openWriter(templateType); assertTrue(outFile.exists()); assertNull(action.openWriter(templateType)); }