public static SonarEdition loadEdition(System2 system) {
    URL url = system.getResource(EDITION_FILE_PATH);
    if (url == null) {
      return SonarEdition.COMMUNITY;
    }
    try (Scanner scanner = new Scanner(url.openStream(), StandardCharsets.UTF_8)) {
      String editionInFile = scanner.nextLine();
      return parseEdition(editionInFile);
    } catch (IOException e) {
      throw new IllegalStateException(format(CAN_NOT_LOAD_FROM_CLASSPATH, EDITION_FILE_PATH), e);
    }
  }
@Test
  void load_edition_defaults_to_community_if_file_not_found() throws MalformedURLException {
    when(system.getResource(anyString())).thenReturn(new File("target/unknown").toURI().toURL());
    SonarEdition edition = MetadataLoader.loadEdition(System2.INSTANCE);
    assertThat(edition).isEqualTo(SonarEdition.COMMUNITY);
  }