package io.quarkus.it.kubernetes;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;

final class TestUtil {

    private TestUtil() {
    }

    /**
     * Gets the project version from a version.txt (that has been properly setup in maven to contain the version)
     * This is needed in order to avoid hard-coding Quarkus dependency versions that could break the release process
     */
    public static String getProjectVersion() {
        try (BufferedReader bufferedReader = new BufferedReader(
                new InputStreamReader(TestUtil.class.getResourceAsStream("/version.txt")))) {
            return bufferedReader.readLine();
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }
}
