Skip to content

Commit 396b6cb

Browse files
Test cases for model added
1 parent 691b641 commit 396b6cb

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/FileConstraintTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
1616
package com.adobe.cq.forms.core.components.internal.models.v1.form;
1717

18+
import java.util.Collections;
19+
1820
import org.junit.jupiter.api.Test;
1921
import org.junit.jupiter.api.extension.ExtendWith;
2022
import org.mockito.Mockito;
@@ -42,4 +44,11 @@ void testGetAccept() {
4244
Mockito.when(fileConstraintMock.getAccept()).thenCallRealMethod();
4345
assertThat(FileConstraint.DEFAULT_ACCEPT, is(fileConstraintMock.getAccept()));
4446
}
47+
48+
@Test
49+
void testGetAcceptExtensions() {
50+
FileConstraint fileConstraintMock = Mockito.mock(FileConstraint.class);
51+
Mockito.when(fileConstraintMock.getAcceptExtensions()).thenCallRealMethod();
52+
assertEquals(Collections.emptyList(), fileConstraintMock.getAcceptExtensions());
53+
}
4554
}

bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v3/form/FileInputImplV3Test.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public class FileInputImplV3Test {
5959
private static final String PATH_FILEINPUT_DATALAYER = CONTENT_ROOT + "/fileinput-datalayer";
6060
private static final String PATH_MULTISELECT_FILEINPUT = CONTENT_ROOT + "/multiselect-fileinput";
6161
private static final String PATH_MULTISELECT_FILEINPUT_WITHNOTYPE = CONTENT_ROOT + "/multiselect-fileinput-withNoType";
62+
private static final String PATH_FILEINPUT_WITH_MIME_TYPE = CONTENT_ROOT + "/fileinput-with-mime-type";
6263

6364
private final AemContext context = FormsCoreComponentTestContext.newAemContext();
6465

@@ -400,4 +401,14 @@ void testJSONExportDataLayer() throws Exception {
400401
FieldUtils.writeField(fileInput, "dataLayerEnabled", true, true);
401402
Utils.testJSONExport(fileInput, Utils.getTestExporterJSONPath(BASE, PATH_FILEINPUT_DATALAYER));
402403
}
404+
405+
@Test
406+
void testGetAcceptExtensions() {
407+
FileInput fileInput = Utils.getComponentUnderTest(PATH_FILEINPUT_CUSTOMIZED, FileInput.class, context);
408+
// assert fileInput.getAcceptExtensions() to return empty list
409+
assertEquals(Collections.emptyList(), fileInput.getAcceptExtensions());
410+
FileInput fileInputMock = Mockito.mock(FileInput.class);
411+
Mockito.when(fileInputMock.getAcceptExtensions()).thenCallRealMethod();
412+
assertEquals(Collections.emptyList(), fileInput.getAcceptExtensions());
413+
}
403414
}

0 commit comments

Comments
 (0)