Package honeycrm.server.test.small

Source Code of honeycrm.server.test.small.NewDtoWizardTest

package honeycrm.server.test.small;

import honeycrm.client.dto.Configuration;
import honeycrm.client.dto.ModuleDto;
import honeycrm.server.NewDtoWizard;

import java.util.HashMap;
import java.util.Map;

import junit.framework.TestCase;

public class NewDtoWizardTest extends TestCase {
  public void testWizard() {
    final Configuration c = NewDtoWizard.getConfiguration();

    final String kind = "Contact";

    final ModuleDto contact = c.getModuleDtos().get(kind);
    assertEquals(kind, contact.getModule());
    assertNotNull(contact.getExtraButtons());
    assertNotNull(contact.getFields());
    assertNotNull(contact.getFieldById("name"));
    assertNotNull(contact.getFieldById("accountId"));
  }

  public void testRelateFieldMappings() {
    final HashMap<String, ModuleDto> moduleDtos = NewDtoWizard.getConfiguration().getModuleDtos();
   
    for (final Map.Entry<String, ModuleDto> entry: moduleDtos.entrySet()) {
      final ModuleDto moduleDto = entry.getValue();

      assertEquals(entry.getKey(), moduleDto.getModule());

      for (final Map.Entry<String, String> relate: entry.getValue().getRelateFieldMappings().entrySet()) {
        final boolean relatedEntityExists = moduleDtos.containsKey(relate.getValue());
        assertTrue(relatedEntityExists);
      }
    }
  }
}
TOP

Related Classes of honeycrm.server.test.small.NewDtoWizardTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.