@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 testStableChannelProposedByDefault() {
    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 channelToPropose = result.getChannelToPropose();
    assertNotNull(channelToPropose);
    assertEquals("IDEA_Release", channelToPropose.getId());

    settings.setKnownChannelIds(Collections.singletonList(channelToPropose.getId()));
    result = strategy.checkForUpdates();
    assertEquals(UpdateStrategy.State.LOADED, result.getState());
    assertNull(result.getChannelToPropose());
  }
  @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));
  }
  @Test
  public void testNewChannelAppears() {
    // assume user has version 9 eap subscription (default or selected)
    // and new channel appears - eap of version 10 is there
    TestUpdateSettings settings = new TestUpdateSettings(ChannelStatus.RELEASE);
    UpdateStrategyCustomization customization = new UpdateStrategyCustomization();
    UpdateStrategy strategy =
        new UpdateStrategy(
            9,
            BuildNumber.fromString("IU-95.627"),
            InfoReader.read("idea-newChannel-release.xml"),
            settings,
            customization);

    CheckForUpdateResult result = strategy.checkForUpdates();
    assertEquals(UpdateStrategy.State.LOADED, result.getState());
    BuildInfo update = result.getNewBuildInSelectedChannel();
    assertNull(update);

    UpdateChannel newChannel = result.getChannelToPropose();
    assertNotNull(newChannel);
    assertEquals("IDEA10EAP", newChannel.getId());
    assertEquals("IntelliJ IDEA X EAP", newChannel.getName());
  }