BAEL-20869 Move remaining spring boot modules

This commit is contained in:
mikr
2020-02-02 20:44:54 +01:00
parent 3e26f588fc
commit 06161e1bae
704 changed files with 1303 additions and 1501 deletions
@@ -0,0 +1,26 @@
package com.baeldung.environmentpostprocessor;
import static org.junit.Assert.assertEquals;
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.junit4.SpringRunner;
import com.baeldung.environmentpostprocessor.service.PriceCalculationService;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = PriceCalculationApplication.class)
public class PriceCalculationEnvironmentPostProcessorLiveTest {
@Autowired
PriceCalculationService pcService;
@Test
public void whenSetNetEnvironmentVariablebyDefault_thenNoTaxApplied() {
double total = pcService.productTotalPrice(100, 4);
assertEquals(400.0, total, 0);
}
}
@@ -0,0 +1,27 @@
package com.baeldung.properties;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
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.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = ExternalPropertyFileLoader.class)
public class ExternalPropertyFileLoaderIntegrationTest {
@Autowired
ConfProperties props;
@Test
public void whenExternalisedPropertiesLoaded_thenReadValues() throws IOException {
assertEquals("jdbc:postgresql://localhost:5432/", props.getUrl());
assertEquals("admin", props.getUsername());
assertEquals("root", props.getPassword());
}
}