0

I have ConfigProperties.class

public class ConfigProperties {

@BeforeTest
public void TestDataSetup() throws FileNotFoundException {
        File src = new File("src\\main\\resources\\config.properties");
        FileInputStream fis = new FileInputStream(src);
        ConfigProperties properties = new ConfigProperties();
        properties.load(fis);
    }

public void load(FileInputStream fis) {
}
}

below test method

public class Paragraphs extends ConfigProperties {

Properties prop = new Properties();


public void createParagraph() {
    RestAssured.baseURI = prop.getProperty("paragraphsURL");

here is config.properties

paragraphsURL=http://192.168.0.139:8880/paragraphs

After running my test I received error

java.lang.IllegalArgumentException: baseURI cannot be null

After debugging I have

RestAssured.baseURI = Class not loaded : io.restassured.RestAssured
goney225
  • 91
  • 1
  • 1
  • 10
  • are you certain your `prop.getProperty("paragraphsURL")` call returns any data? Why don't you debug or print it out – LIvanov Oct 07 '20 at 06:27
  • After debugging RestAssured.baseURI = Class not loaded : io.restassured.RestAssured – goney225 Oct 07 '20 at 06:33
  • So I'd suggest you dig into this a bit and rephrase the question – LIvanov Oct 07 '20 at 06:34
  • @LIvanov maybe any tip? I'm searching something about this in chrome but there is nothing. – goney225 Oct 07 '20 at 07:30
  • Ok I did it. Below my code: String propertiesFileName = "config.properties"; ClassLoader loader = Thread.currentThread().getContextClassLoader(); Properties prop = new Properties(); InputStream resourceStream = loader.getResourceAsStream(propertiesFileName); { try { prop.load(resourceStream); } catch (IOException e) { e.printStackTrace(); } } – goney225 Oct 07 '20 at 08:57
  • this is the answer or an edit to the question ? – Wilfred Clement Oct 07 '20 at 10:01

0 Answers0