sync source code with article

This commit is contained in:
amit.pandey
2020-04-12 00:01:36 +05:30
parent ae8fb70e40
commit 5b88ab42df
20 changed files with 310 additions and 8 deletions
@@ -0,0 +1,30 @@
package com.baeldung.configurationproperties;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
import com.baeldung.properties.ConfigPropertiesDemoApplication;
import com.baeldung.properties.Database;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = ConfigPropertiesDemoApplication.class)
@TestPropertySource("classpath:application.properties")
public class DatabasePropertiesIntegrationTest {
@Autowired
private Database database;
@Test
public void testDatabaseProperties() {
Assert.assertNotNull(database);
Assert.assertEquals("jdbc:postgresql:/localhost:5432/instance", database.getUrl());
Assert.assertEquals("foo", database.getUsername());
Assert.assertEquals("bar", database.getPassword());
}
}