@Test
  public void systemNotificationFields() throws Exception {
    doLogin();

    ServerTab serverCfg = main.openServer();

    serverCfg.getNotificationsEnabled().check(true);
    serverCfg.getNotificationEmails().type("[email protected],[email protected]");
    serverCfg.getNotificationRoles().add("anonymous");
    serverCfg.getNotificationRoles().add("admin");

    MockListener<GlobalConfigurationResourceResponse> ml =
        MockHelper.listen(
            GlobalConfigurationPlexusResource.RESOURCE_URI,
            new MockListener<GlobalConfigurationResourceResponse>() {
              @Override
              public void onPayload(Object payload, MockEvent evt) {
                if (!Method.PUT.equals(evt.getMethod())) {
                  evt.block();
                } else {
                  assertThat(payload, not(nullValue()));
                  assertThat(payload, is(instanceOf(GlobalConfigurationResourceResponse.class)));

                  GlobalConfigurationResourceResponse resource =
                      (GlobalConfigurationResourceResponse) payload;

                  assertThat(resource.getData().getSystemNotificationSettings(), not(nullValue()));
                  assertThat(
                      resource.getData().getSystemNotificationSettings().getEmailAddresses(),
                      equalTo("[email protected],[email protected]"));
                  assertThat(
                      resource.getData().getSystemNotificationSettings().getRoles().size(),
                      equalTo(2));
                  assertThat(
                      resource.getData().getSystemNotificationSettings().getRoles().get(0),
                      equalTo("anonymous"));
                  assertThat(
                      resource.getData().getSystemNotificationSettings().getRoles().get(1),
                      equalTo("admin"));
                  assertThat(
                      resource.getData().getSystemNotificationSettings().isEnabled(),
                      equalTo(true));
                }
              }
            });

    serverCfg.save();
    Thread.sleep(1000);

    assertNotNull(ml.waitForPayload(GlobalConfigurationResourceResponse.class));

    MockHelper.checkAndClean();
  }
  @Test
  public void requiredFields() {
    doLogin();

    ServerTab serverCfg = main.openServer();
    assertErrorText(serverCfg.getSmtpHost(), "127.0.0.1");
    assertErrorText(serverCfg.getSmtpPort(), 1125);
    assertErrorText(serverCfg.getSmtpEmail(), "*****@*****.**");

    assertErrorText(serverCfg.getGlobalTimeout(), 10);
    assertErrorText(serverCfg.getGlobalRetry(), 3);

    serverCfg.getSecurityRealms().removeAll();
    Assert.assertTrue(serverCfg.getSecurityRealms().hasErrorText("Select one or more items"));
    serverCfg.getSecurityRealms().addAll();
    Assert.assertFalse(serverCfg.getSecurityRealms().hasErrorText("Select one or more items"));

    assertErrorText(serverCfg.getSecurityAnonymousUsername(), "anonymous");
    assertErrorText(serverCfg.getSecurityAnonymousPassword(), "anonymous");

    assertErrorText(serverCfg.getApplicationBaseUrl(), "http://localhost:8081/nexus");
  }