Package org.sonar.wsclient.services

Examples of org.sonar.wsclient.services.Authentication


import static org.fest.assertions.Fail.fail;

public class AuthenticationUnmarshallerTest extends UnmarshallerTestCase {
  @Test
  public void should_unmarshall_valid_authentication() {
    Authentication authentication = new AuthenticationUnmarshaller().toModel(loadFile("/authentication/authentication_valid.json"));

    assertThat(authentication.isValid()).isTrue();
  }
View Full Code Here


    assertThat(authentication.isValid()).isTrue();
  }

  @Test
  public void should_unmarshall_invalid_authentication() {
    Authentication authentication = new AuthenticationUnmarshaller().toModel(loadFile("/authentication/authentication_invalid.json"));

    assertThat(authentication.isValid()).isFalse();
  }
View Full Code Here

    assertThat(authentication.isValid()).isFalse();
  }

  @Test
  public void should_unmarshall_empty_authentication() {
    Authentication authentication = new AuthenticationUnmarshaller().toModel("{}");

    assertThat(authentication.isValid()).isFalse();
  }
View Full Code Here

  public Authentication toModel(String json) {
    WSUtils utils = WSUtils.getINSTANCE();
    Object map = utils.parse(json);

    Boolean validJson = utils.getBoolean(map, "valid");
    return new Authentication().setValid(validJson != null ? validJson : false);
  }
View Full Code Here

TOP

Related Classes of org.sonar.wsclient.services.Authentication

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.