Skip to content

Commit

Permalink
Fix error in validation test
Browse files Browse the repository at this point in the history
  • Loading branch information
markusweigelt committed Nov 21, 2023
1 parent 339171d commit 7c05ce4
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.kitodo.api.dataformat.LogicalDivision;
import org.kitodo.api.dataformat.MediaPartialView;
Expand Down Expand Up @@ -43,8 +44,17 @@ public class MediaPartialFormTest {
LogicalDivision logicalDivision;
PhysicalDivision physicalDivision;

@BeforeClass
public static void initTestClass() {
// mock frontend update calls
Mockito.mockStatic(Ajax.class);
PrimeFaces primeFaces = mock(PrimeFaces.class);
MockedStatic<PrimeFaces> primefacesSingleton = Mockito.mockStatic(PrimeFaces.class);
primefacesSingleton.when(PrimeFaces::current).thenReturn(primeFaces);
}

@Before
public void init() {
public void initTest() {
dataEditorForm = mock(DataEditorForm.class);
Workpiece workpiece = mock(Workpiece.class);
when(workpiece.getPhysicalStructure()).thenReturn(new PhysicalDivision());
Expand Down Expand Up @@ -73,12 +83,6 @@ public void init() {
LinkedList ancestorsOfPhysicalDivision = new LinkedList<>();
ancestorsOfPhysicalDivision.add(new PhysicalDivision());
doReturn(ancestorsOfPhysicalDivision).when(mediaPartialForm).getAncestorsOfPhysicalDivision();

// mock frontend update calls
Mockito.mockStatic(Ajax.class);
PrimeFaces primeFaces = mock(PrimeFaces.class);
MockedStatic<PrimeFaces> primefacesSingleton = Mockito.mockStatic(PrimeFaces.class);
primefacesSingleton.when(PrimeFaces::current).thenReturn(primeFaces);
}

@Test
Expand Down

0 comments on commit 7c05ce4

Please sign in to comment.