コード例 #1
0
  @Before
  public void setUp() throws Exception {
    initMocks(this);

    config = ConfigsUtils.prepareConfigOne();

    when(configService.getByName(config.getName())).thenReturn(config);

    appSchemaChangeController = new AppSchemaChangeController(eventRelay, configService);
    controller = MockMvcBuilders.standaloneSetup(appSchemaChangeController).build();
  }
コード例 #2
0
  @Test
  public void shouldReturnConfigurationWithUpdatedName() throws CommcareConnectionFailureException {

    List<Config> configList = new ArrayList<>();
    configList.add(ConfigsUtils.prepareConfigOne());
    configList.add(ConfigsUtils.prepareConfigTwo());
    Config firstConfig = configList.get(0);

    Configs configs = new Configs(configList);
    configs.setDefaultConfigName(firstConfig.getName());
    configService.setConfigs(configs);

    Config updatedConfig = new Config();
    updatedConfig.setAccountConfig(firstConfig.getAccountConfig());
    updatedConfig.setName("UpdatedOne");

    String oldName = firstConfig.getName();
    Config savedConfig = configService.updateConfig(updatedConfig, oldName);

    assertEquals("UpdatedOne", savedConfig.getName());
  }