From Fedora Project Wiki

Description

This test case ensures that the alternatives system can manage and switch between alternative programs for a given function.

Setup

Ensure you have a Fedora system with multiple versions of a program that uses the alternatives system. For this example, let's consider Java (java and javac commands).

How to test

  1. Open a terminal.
  2. List all the available alternatives for the java command: alternatives --display java.
  3. Note down the currently selected version.
  4. Change the default java using: sudo alternatives --config java and select a different version from the list.
  5. Check the active version after changing it using: java -version.
  6. Switch back to the original version using sudo alternatives --config java.

Expected Results

  1. The alternatives --display java command should list all available versions of Java with their corresponding paths.
  2. After changing the default using --config, the output of java -version should match the version you switched to.
  3. Switching back should also reflect the appropriate version when you check with java -version.

Optional

For further exploration:

  1. Try the same process with other commands that use the alternatives system, like javac.
  2. Install or remove a program version and observe how alternatives updates the list.