use of com.haulmont.chile.core.model.impl.MetaClassImpl in project cuba by cuba-platform.
the class BaseGenericIdEntityTest method setUp.
@BeforeEach
public void setUp() throws Exception {
dynamicAttributes = new DynamicAttributes() {
@Override
public Collection<Category> getCategoriesForMetaClass(MetaClass metaClass) {
return null;
}
@Override
public Collection<CategoryAttribute> getAttributesForMetaClass(MetaClass metaClass) {
return null;
}
@Nullable
@Override
public CategoryAttribute getAttributeForMetaClass(MetaClass metaClass, String code) {
CategoryAttribute categoryAttribute = new CategoryAttribute();
categoryAttribute.setCode(code);
return categoryAttribute;
}
};
metadata = new Metadata() {
@Override
public Session getSession() {
return new SessionImpl() {
@Override
public MetaClass getClassNN(String name) {
return new MetaClassImpl(new MetaModelImpl(this, name), name);
}
@Override
public MetaClass getClassNN(Class clazz) {
return new MetaClassImpl(new MetaModelImpl(this, clazz.getName()), clazz.getName());
}
};
}
@Override
public ViewRepository getViewRepository() {
return null;
}
@Override
public ExtendedEntities getExtendedEntities() {
return null;
}
@Override
public MetadataTools getTools() {
return null;
}
@Override
public DatatypeRegistry getDatatypes() {
return null;
}
@Override
public <T extends Entity> T create(Class<T> entityClass) {
if (User.class.equals(entityClass)) {
return (T) new User();
}
if (CategoryAttributeValue.class.equals(entityClass)) {
CategoryAttributeValue attributeValue = new CategoryAttributeValue();
attributeValue.setEntity(new ReferenceToEntity());
return (T) attributeValue;
}
throw new IllegalArgumentException("Add support for " + entityClass.getSimpleName() + " to Mock");
}
@Override
public Entity create(MetaClass metaClass) {
return null;
}
@Override
public Entity create(String entityName) {
return null;
}
@Override
public List<String> getRootPackages() {
return null;
}
@Override
public MetaModel getModel(String name) {
return null;
}
@Override
public Collection<MetaModel> getModels() {
return null;
}
@Nullable
@Override
public MetaClass getClass(String name) {
return null;
}
@Override
public MetaClass getClassNN(String name) {
return null;
}
@Nullable
@Override
public MetaClass getClass(Class<?> clazz) {
return null;
}
@Override
public MetaClass getClassNN(Class<?> clazz) {
return null;
}
@Override
public Collection<MetaClass> getClasses() {
return null;
}
};
new Expectations() {
{
AppBeans.get(DynamicAttributes.NAME);
result = dynamicAttributes;
minTimes = 0;
AppBeans.get(Metadata.NAME);
result = metadata;
minTimes = 0;
AppBeans.get(ReferenceToEntitySupport.class);
result = referenceToEntitySupport;
minTimes = 0;
}
};
}
Aggregations