Merge branch 'master' of github.com:ZUGFeRD/mustangproject

This commit is contained in:
jstaerk
2024-07-11 16:35:51 +02:00
8 changed files with 78 additions and 95 deletions

View File

@@ -6,17 +6,18 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.mustangproject.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.logging.Level;
import java.util.logging.Logger;
/***
* tests the linecalculator and transactioncalculator classes
*
*/
public class CalculationTest {
private static final Logger LOGGER = LoggerFactory.getLogger (CalculationTest.class);
@Test
public void testLineCalculator_simpleAmounts_resultInValidVATAmount() {
@@ -92,7 +93,7 @@ public class CalculationTest {
invoice.setDeliveryDate(sqlDate.parse("2020-12-31"));
invoice.setDueDate(sqlDate.parse("2021-01-15"));
} catch (Exception e) {
Logger.getLogger(CalculationTest.class.getName()).log(Level.SEVERE, null, e);
LOGGER.error("Failed to set dates", e);
}

View File

@@ -22,15 +22,16 @@ import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This test utility class is providing usability functions to test file resources
*/
public class ResourceUtilities {
private static final Logger LOG = Logger.getLogger(ResourceUtilities.class.getName());
private static final Logger LOGGER = LoggerFactory.getLogger (ResourceUtilities.class);
/**
* Loading a File into a String using a certain encoding and file path
@@ -73,7 +74,7 @@ public class ResourceUtilities {
uri = ResourceUtilities.class.getClassLoader().getResource(relativeFilePath).toURI();
uri = new URI(toExternalForm(uri));
} catch (URISyntaxException ex) {
LOG.log(Level.SEVERE, null, ex);
LOGGER.error("Failed to parse URI", ex);
}
if (uri == null) {
throw new FileNotFoundException("Could not find the file '" + relativeFilePath + "'!");
@@ -129,7 +130,7 @@ public class ResourceUtilities {
try {
filepath = ResourceUtilities.class.getClassLoader().getResource("").toURI().getPath() + relativeFilePath;
} catch (URISyntaxException ex) {
LOG.log(Level.SEVERE, null, ex);
LOGGER.error("Failed to parse URI", ex);
}
return new File(filepath);
}
@@ -142,7 +143,7 @@ public class ResourceUtilities {
try {
testFolder = ResourceUtilities.class.getClassLoader().getResource("").toURI().getPath();
} catch (URISyntaxException ex) {
LOG.log(Level.SEVERE, null, ex);
LOGGER.error("Failed to parse URI", ex);
}
return testFolder;
}
@@ -206,7 +207,7 @@ public class ResourceUtilities {
try {
ret = new URI(sb.toString()).toASCIIString();
} catch (URISyntaxException ex) {
LOG.log(Level.SEVERE, null, ex);
LOGGER.error("Failed to parse URI", ex);
}
return ret;
}