Mocking java in powershell

Welcome Forums Pester Mocking java in powershell

Viewing 2 reply threads
  • Author
    Posts
    • #214149
      Participant
      Topics: 1
      Replies: 0
      Points: 11
      Rank: Member

      My ps script has the following code:

      I later inspect $WProcess value, as well as validate $consoleOutPath file and $consoleErrPath, which are files.

      How can I mock this as I don’t want to actually run the java program?  I would like to mock the return value, as well as what gets written to the console.out and console.err files.

      Thank you, ahead of time!

      • This topic was modified 6 months, 3 weeks ago by sclieu78.
    • #215163
      Senior Moderator
      Topics: 9
      Replies: 1370
      Points: 5,048
      Helping Hand
      Rank: Community MVP

      If you mock, then the files are not gonna get generated. You can mock Start-Process by just returning a PScustomobject in Mock function.

    • #236500
      Participant
      Topics: 0
      Replies: 1
      Points: 5
      Rank: Member
Viewing 2 reply threads
  • The topic ‘Mocking java in powershell’ is closed to new replies.