Package org.sonar.wsclient.services

Examples of org.sonar.wsclient.services.Event


public class EventUnmarshaller extends AbstractUnmarshaller<Event> {

  @Override
  protected Event parse(Object json) {
    WSUtils utils = WSUtils.getINSTANCE();
    return new Event()
        .setId(utils.getString(json, "id"))
        .setResourceKey(utils.getString(json, "rk"))
        .setName(utils.getString(json, "n"))
        .setCategory(utils.getString(json, "c"))
        .setDate(utils.getDateTime(json, "dt"))
View Full Code Here


public class EventUnmarshallerTest extends UnmarshallerTestCase {

  @Test
  public void toModel() throws Exception {
    List<Event> events = new EventUnmarshaller().toModels(loadFile("/events/events.json"));
    Event event = events.get(0);
    assertThat(event.getId(), is("10"));
    assertThat(event.getName(), is("foo"));
    assertThat(event.getDescription(), is("desc"));
    assertThat(event.getCategory(), is("categ"));
    final Date expectedDate = new SimpleDateFormat("yyyy-MM-dd'T'kk:mm:ssZZZZ").parse("2009-12-25T15:59:23+0000");
    assertThat(event.getDate(), is(expectedDate));
  }
View Full Code Here

TOP

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

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.