@Test
  public void testNewChannelAndNewBuildAppear() {
    // assume user has version 9 eap subscription (default or selected)
    // and new channels appears - eap of version 10 is there
    // and new build withing old channel appears also
    // we need to show only one dialog
    TestUpdateSettings settings = new TestUpdateSettings(ChannelStatus.EAP);
    UpdateStrategyCustomization customization = new UpdateStrategyCustomization();
    UpdateStrategy strategy =
        new UpdateStrategy(
            9,
            BuildNumber.fromString("IU-95.429"),
            InfoReader.read("idea-newChannel.xml"),
            settings,
            customization);

    CheckForUpdateResult result = strategy.checkForUpdates();
    assertEquals(UpdateStrategy.State.LOADED, result.getState());
    BuildInfo update = result.getNewBuildInSelectedChannel();
    assertNotNull(update);
    assertEquals("95.627", update.getNumber().toString());

    UpdateChannel newChannel = result.getChannelToPropose();
    assertNotNull(newChannel);
    assertEquals("IDEA10EAP", newChannel.getId());
    assertEquals("IntelliJ IDEA X EAP", newChannel.getName());
  }
  @Test
  public void testParallelCampaignsInChannel() {
    BuildNumber currentBuild = BuildNumber.fromString("IU-143.381");
    TestUpdateSettings settings = new TestUpdateSettings(ChannelStatus.EAP);
    UpdateStrategyCustomization customization = new UpdateStrategyCustomization();
    UpdateStrategy strategy =
        new UpdateStrategy(
            15, currentBuild, InfoReader.read("idea-2eap.xml"), settings, customization);

    CheckForUpdateResult result = strategy.checkForUpdates();
    assertEquals(UpdateStrategy.State.LOADED, result.getState());
    BuildInfo build = result.getNewBuildInSelectedChannel();
    assertNotNull(build);
    assertEquals("143.888", build.getNumber().toString());
  }
  @Test
  public void testWithUserSelection() {
    // assume user has version 9 eap - and used eap channel - we want to introduce new eap
    TestUpdateSettings settings = new TestUpdateSettings(ChannelStatus.EAP);
    UpdateStrategyCustomization customization = new UpdateStrategyCustomization();
    UpdateStrategy strategy =
        new UpdateStrategy(
            9,
            BuildNumber.fromString("IU-95.429"),
            InfoReader.read("idea-new9eap.xml"),
            settings,
            customization);

    CheckForUpdateResult result = strategy.checkForUpdates();
    assertEquals(UpdateStrategy.State.LOADED, result.getState());
    BuildInfo update = result.getNewBuildInSelectedChannel();
    assertNotNull(update);
    assertEquals("95.627", update.getNumber().toString());
  }
  @Test
  public void testChannelWithCurrentStatusPreferred() {
    BuildNumber currentBuild = BuildNumber.fromString("IU-139.658");
    TestUpdateSettings settings = new TestUpdateSettings(ChannelStatus.EAP);
    UpdateStrategyCustomization customization = new UpdateStrategyCustomization();
    UpdateStrategy strategy =
        new UpdateStrategy(
            14, currentBuild, InfoReader.read("idea-patchAvailable.xml"), settings, customization);

    CheckForUpdateResult result = strategy.checkForUpdates();
    assertEquals(UpdateStrategy.State.LOADED, result.getState());

    UpdateChannel channel = result.getUpdatedChannel();
    assertNotNull(channel);
    assertEquals(ChannelStatus.EAP, channel.getStatus());

    BuildInfo selectedChannel = result.getNewBuildInSelectedChannel();
    assertNotNull(selectedChannel);
    assertNotNull(selectedChannel.findPatchForBuild(currentBuild));
  }
  @Test
  public void testStableUpdatePreferredByDefault() {
    BuildNumber currentBuild = BuildNumber.fromString("IU-143.381");
    TestUpdateSettings settings = new TestUpdateSettings(ChannelStatus.RELEASE);
    UpdateStrategyCustomization customization = new UpdateStrategyCustomization();
    UpdateStrategy strategy =
        new UpdateStrategy(
            15, currentBuild, InfoReader.read("idea-123280.xml"), settings, customization);

    CheckForUpdateResult result = strategy.checkForUpdates();
    assertEquals(UpdateStrategy.State.LOADED, result.getState());

    UpdateChannel channel = result.getUpdatedChannel();
    assertNotNull(channel);
    assertEquals(ChannelStatus.RELEASE, channel.getStatus());

    BuildInfo build = result.getNewBuildInSelectedChannel();
    assertNotNull(build);
    assertEquals("143.382", build.getNumber().toString());
    assertNotNull(build.findPatchForBuild(currentBuild));
  }