コード例 #1
0
  @Test
  public void process_givenUsagePointEntry() {
    UsagePoint usagePoint = new UsagePoint();
    usagePoint.setServiceCategory(new ServiceCategory(ServiceCategory.ELECTRICITY_SERVICE));
    entry.getContent().setUsagePoint(usagePoint);

    EntryType entryType = processor.process(entry);

    assertThat(entryType.getContent().getResource().getId(), is(notNullValue()));
  }
コード例 #2
0
  @Test
  public void link_linkRelated() {
    String relatedLink = UUID.randomUUID().toString();
    MeterReading meterReading = EspiFactory.newMeterReading();
    meterReading.setUpLink(new LinkType(LinkType.UP, relatedLink));
    resourceService.persist(meterReading);
    UsagePoint usagePoint = factory.createUsagePoint();
    usagePoint.getRelatedLinks().add(new LinkType(LinkType.RELATED, relatedLink));
    resourceService.persist(usagePoint);

    assertThat(meterReading.getUsagePoint(), is(nullValue()));

    linker.link(usagePoint);

    assertThat(meterReading.getUsagePoint(), equalTo(usagePoint));
  }