Skip to content

Commit

Permalink
Исправлен spy от spy
Browse files Browse the repository at this point in the history
  • Loading branch information
nixel2007 committed Dec 26, 2023
1 parent 1e5ca45 commit 5c35d4d
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,16 @@ private void checkMockHandler(ModuleType type, boolean noneModules) {
var documentContext = spy(getDocumentContext());
when(documentContext.getModuleType()).thenReturn(type);

final var infoReg = spy(context.getConfiguration().findChild(MdoReference.create(MDOType.INFORMATION_REGISTER,
"РегистрСведений1")).get()
final var infoReg = spy((InformationRegister) context.getConfiguration().findChild(MdoReference.create(MDOType.INFORMATION_REGISTER,
"РегистрСведений1")).orElseThrow()
);
var spyMdo = spy((InformationRegister) infoReg);

when(documentContext.getMdObject()).thenReturn(Optional.of(spyMdo));
when(documentContext.getMdObject()).thenReturn(Optional.of(infoReg));

if (noneModules) {
when(spyMdo.getModules()).thenReturn(Collections.emptyList());
when(infoReg.getModules()).thenReturn(Collections.emptyList());

List<MD> children = List.of(spyMdo);
List<MD> children = List.of(infoReg);

var configuration = spy(context.getConfiguration());
when(configuration.getChildren()).thenReturn(children);
Expand Down

0 comments on commit 5c35d4d

Please sign in to comment.