0

I'm writing a test for a REST controller in Spring Boot. Is uses is(), but my IDE is not suggesting what package this is in so I'm unable to find it.

Here's my test method;

@Test
    public void printerIsReady() throws Exception {
        /* Set the contents of status.txt to anything other than 3 */
        String statusFilePath = printerPath + "/status.txt";
        PrinterFileHelper.writeToFile("5", statusFilePath);

        this.mockMvc.perform(get("/printer"))
                .andExpect(status().isOk())
                .andExpect(jsonPath("$.status", is("READY")));

    }

I'm finding a lot of examples online that use the is() method, but it's not clear at all what package I need to be adding in order to access it.

SheppardDigital
  • 3,165
  • 8
  • 44
  • 74

1 Answers1

0

I found the answer here How to check String in response body with mockMvc

The package you need to import is;

import static org.hamcrest.Matchers.*;

I needed to add the package to my pom.xml file

<dependency>
    <groupId>org.testinfected.hamcrest-matchers</groupId>
    <artifactId>core-matchers</artifactId>
    <version>1.5</version>
</dependency>
SheppardDigital
  • 3,165
  • 8
  • 44
  • 74