title: JUnit test for website contains one string or (exclusive) other string
body: <p>In a spring-mvc project I have a test for the content of the index/homepage:</p>
  
  <pre><code>@RunWith(SpringRunner.class)
  @SpringBootTest
  @AutoConfigureMockMvc
  public class HomePageTest {
  
      @Autowired
      private MockMvc mockMvc;
  
      @Test
      public void shouldContainStrings() throws Exception {
          this.mockMvc.perform(get("/")).andDo(print()).andExpect(status().isOk())
              .andExpect(content().string(containsString("Hello World")));
      }
  }
  </code></pre>
  
  <p>This test works fine so far. But now I would like to test for the occurrence of the strings "Login" or (excl) "Logout", i.e. I want to test whether exactly one (not zero and not both) of these two strings appears in the content. How can I match this or condition?</p>
  
  <p>I tried</p>
  
  <pre><code>...
  .andExpect(content().string(
        either(containsString("Login")).or(containsString("Logout"))));
  ....
  </code></pre>
  
  <p>But this does not work either (does not give an error if both strings appear in the page).</p>