예제 #1
0
  @Test
  public void verifyFullyLoadedAlarmIsEncoded() throws Exception {
    final JsonCodec<Alarm> alarmCodec = context.codec(Alarm.class);

    final Alarm alarm = getDecodedAlarm(alarmCodec, "alarm-full.json");
    assertCommon(alarm);

    assertThat(alarm.timeCleared(), is(2222L));
    assertThat(alarm.assignedUser(), is("foo"));
  }
예제 #2
0
  @Test
  public void verifyMinimalAlarmIsEncoded() throws Exception {
    final JsonCodec<Alarm> alarmCodec = context.codec(Alarm.class);

    final Alarm alarm = getDecodedAlarm(alarmCodec, "alarm-minimal.json");
    assertCommon(alarm);

    assertThat(alarm.timeCleared(), nullValue());
    assertThat(alarm.assignedUser(), nullValue());
  }