Fix unit test
This commit is contained in:
parent
1eafec94b3
commit
782bfc65b8
|
@ -1,20 +1,20 @@
|
|||
package ctbrec.recorder.postprocessing;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import ctbrec.Config;
|
||||
import ctbrec.Recording;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import ctbrec.Config;
|
||||
import ctbrec.Recording;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
class AbstractPlaceholderAwarePostProcessorTest extends AbstractPpTest {
|
||||
|
||||
|
@ -120,7 +120,7 @@ class AbstractPlaceholderAwarePostProcessorTest extends AbstractPpTest {
|
|||
@Test
|
||||
void testAbsolutePathReplacement() {
|
||||
String input = "asdf_${absolutePath}_asdf";
|
||||
assertEquals("asdf_" + postProcessed.getAbsolutePath().toString() + "_asdf", placeHolderAwarePp.fillInPlaceHolders(input, createPostProcessingContext(rec, null, config)));
|
||||
assertEquals("asdf_" + postProcessed.getAbsolutePath() + "_asdf", placeHolderAwarePp.fillInPlaceHolders(input, createPostProcessingContext(rec, null, config)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -136,14 +136,15 @@ class AbstractPlaceholderAwarePostProcessorTest extends AbstractPpTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
void testPlaceholderDefaultValues() throws IOException {
|
||||
void testPlaceholderDefaultValues() {
|
||||
String input = "asdf_${modelGroupName?${modelSanitizedName?anonymous}}_asdf";
|
||||
PostProcessingContext ctx = createPostProcessingContext(rec, null, config);
|
||||
ctx.getRecording().getModel().setName(null);
|
||||
assertEquals("asdf_anonymous_asdf", placeHolderAwarePp.fillInPlaceHolders(input, ctx));
|
||||
|
||||
input = "asdf_${modelGroupName?${utcDateTime(yyyy)?anonymous}}_asdf";
|
||||
assertEquals("asdf_2021_asdf", placeHolderAwarePp.fillInPlaceHolders(input, ctx));
|
||||
int year = LocalDate.now().getYear();
|
||||
assertEquals("asdf_" + year + "_asdf", placeHolderAwarePp.fillInPlaceHolders(input, ctx));
|
||||
|
||||
ctx.getRecording().setStartDate(null);
|
||||
input = "asdf_${modelGroupName?${utcDateTime(yyyy)?anonymous}}_asdf";
|
||||
|
@ -154,7 +155,7 @@ class AbstractPlaceholderAwarePostProcessorTest extends AbstractPpTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
void testMissingValueForPlaceholder() throws IOException {
|
||||
void testMissingValueForPlaceholder() {
|
||||
String input = "asdf_${modelNotes}_asdf";
|
||||
when(config.getModelNotes(any())).thenReturn(null);
|
||||
assertEquals("asdf__asdf", placeHolderAwarePp.fillInPlaceHolders(input, createPostProcessingContext(rec, null, config)));
|
||||
|
|
Loading…
Reference in New Issue