package net.ranides.assira.system;

import net.ranides.assira.junit.NewAssert;
import net.ranides.assira.reflection.ResolveException;
import org.junit.Assume;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class RuntimeUtilsTest {

    @Test
    public void expand() {
        Assume.assumeNotNull(System.getenv("USERPROFILE"));

        String expected = System.getenv("USERPROFILE") + "/dir/file.txt";
        assertEquals(expected, RuntimeUtils.expand("${USERPROFILE}/dir/file.txt"));

        NewAssert.assertThrows(ResolveException.class, ()->{
            System.out.println(RuntimeUtils.expand("${USERPRO2FILE}/ssh/id_rsa"));
        });
    }
}