Exemplo n.º 1
0
  @Test
  public void testNotEquals_diff_month() throws Exception {
    DpiFile d1 = new DpiFile();
    d1.setFileName("f1");
    d1.setReportingPeriod(new ParmsReportingPeriod(11, 2010));
    Supplier s1 = new Supplier("s1");
    d1.setSupplier(s1);
    GridSupplyPoint g1 = new GridSupplyPoint("g1", d1);
    g1.setHalfHourMpans2ndMonth(true);

    DpiFile d2 = new DpiFile();
    d2.setFileName("f1");
    d2.setReportingPeriod(new ParmsReportingPeriod(12, 2010));
    Supplier s2 = new Supplier("s1");
    d2.setSupplier(s2);
    GridSupplyPoint g2 = new GridSupplyPoint("g2", d2);
    g2.setHalfHourMpans2ndMonth(true);

    assertFalse(g1.equals(g2));
  }
Exemplo n.º 2
0
  @Test
  public void replicate_nonHH_GSP() throws Exception {
    DpiFile srcDpiFile = new DpiFile();
    srcDpiFile.setReportingPeriod(new ParmsReportingPeriod(10, 2011));
    srcDpiFile.setPk(909L);

    DpiFile replicatedDpiFile = new DpiFile();
    replicatedDpiFile.setPk(1909L);

    GridSupplyPoint srcGSP = new GridSupplyPoint("fred", srcDpiFile);
    srcGSP.setHalfHourMpans2ndMonth(false);
    srcGSP.setNonHalfHourMpans2ndMonth(true);

    GridSupplyPoint replGridSupplyPoint = srcGSP.replicate(replicatedDpiFile);

    assertEquals(srcGSP.getName(), replGridSupplyPoint.getName());
    assertNull(srcGSP.getPk());
    assertEquals(replicatedDpiFile.getPk(), replGridSupplyPoint.getDpiFile().getPk());

    assertTrue(srcGSP.isHalfHourMpans2ndMonth() == replGridSupplyPoint.isHalfHourMpans2ndMonth());
    assertTrue(
        srcGSP.isNonHalfHourMpans2ndMonth() == replGridSupplyPoint.isNonHalfHourMpans2ndMonth());

    assertTrue(
        srcGSP.isHalfHourMpansFirstMonth() == replGridSupplyPoint.isHalfHourMpansFirstMonth());
    assertTrue(
        srcGSP.isNonHalfHourMpansFirstMonth()
            == replGridSupplyPoint.isNonHalfHourMpansFirstMonth());
  }