@Test
  public void shouldUpdateProgramProductIfExist() throws Exception {
    Long programId = 88L;
    Long productId = 99L;

    programProduct.setId(1L);
    when(programRepository.getIdByCode(anyString())).thenReturn(programId);
    when(productRepository.getIdByCode(anyString())).thenReturn(productId);

    programProductRepository.save(programProduct);

    assertThat(programProduct.getProgram().getId(), is(88L));
    assertThat(programProduct.getProduct().getId(), is(99L));
    verify(programProductMapper).update(programProduct);
  }
  @Test
  public void shouldCreateProgramProductDTOFromProgramProduct() {

    ProgramProduct programProduct = make(a(defaultProgramProduct));

    programProduct.getProduct().setCategory(new ProductCategory("P1", "Product Name", 1));

    ProgramProductDTO programProductDTO = new ProgramProductDTO(programProduct);

    assertThat(programProductDTO.getProductCode(), is(programProduct.getProduct().getCode()));
    assertThat(
        programProductDTO.getProductName(), is(programProduct.getProduct().getPrimaryName()));
    assertThat(programProductDTO.getProgramCode(), is(programProduct.getProgram().getCode()));
    assertThat(programProductDTO.getProgramName(), is(programProduct.getProgram().getName()));
    assertThat(
        programProductDTO.getCategory(), is(programProduct.getProduct().getCategory().getName()));
    assertThat(
        programProductDTO.getDescription(), is(programProduct.getProduct().getDescription()));
    assertThat(
        programProductDTO.getUnit(), is(programProduct.getProduct().getDosesPerDispensingUnit()));
  }