コード例 #1
0
  @Test
  public void testValidProduct() {
    boolean result = _productValidator.isValid(M_product);

    assertEquals(true, result);
    verifyNoMoreInteractions(S_logger);
  }
コード例 #2
0
  @Test
  public void testThatVerificationFailsIfProductHasNoGeoCoding() {
    PowerMockito.when(M_product.getGeoCoding()).thenReturn(null);

    boolean result = _productValidator.isValid(M_product);

    assertEquals(false, result);
    verify(S_logger, times(1))
        .info("Product skipped. The product 'ProductMock' does not contain a geo coding.");
  }
コード例 #3
0
  @Test
  public void testThatVerificationFailsIfTheProductDoesNotIntersectTheTargetArea() {
    PowerMockito.when(Utils.createProductArea(any(Product.class))).thenReturn(_nonIntersectingArea);

    boolean result = _productValidator.isValid(M_product);

    assertEquals(false, result);
    verify(S_logger, times(1))
        .info("Product skipped. The product 'ProductMock' does not intersect the target product.");
  }
コード例 #4
0
  @Test
  public void testThatVerificationFailsIfTheProductCanNotHandleTheBandConfiguration() {
    PowerMockito.when(M_product.containsBand(sourceBandName)).thenReturn(false);

    boolean result = _productValidator.isValid(M_product);

    assertEquals(false, result);
    verify(S_logger, times(1))
        .info("Product skipped. The product 'ProductMock' does not contain the band 'sbn'.");
  }
コード例 #5
0
  @Test
  public void testThatVerificationFailsIfTheProductDoesNotContainAnEndTime() {
    PowerMockito.when(M_product.getEndTime()).thenReturn(null);

    boolean result = _productValidator.isValid(M_product);

    assertEquals(false, result);
    verify(S_logger, times(1))
        .info("Product skipped. The product 'ProductMock' must contain start and end time.");
  }
コード例 #6
0
  @Test
  public void testThatVerificationFailsIfTheGeoCodingCanNotGetPixelPositionFromGeoPos() {
    PowerMockito.when(M_geoCoding.canGetPixelPos()).thenReturn(false);

    boolean result = _productValidator.isValid(M_product);

    assertEquals(false, result);
    verify(S_logger, times(1))
        .info(
            "Product skipped. The geo-coding of the product 'ProductMock' can not determine the pixel position from a geodetic position.");
  }
コード例 #7
0
  @Test
  public void testThatVerificationFailsIfTheProductEndsAfterTimeRange() {
    final long timeRangeEndTime = _timeRangeEnd.getAsDate().getTime();
    final Date afterTime = new Date(timeRangeEndTime + 1000);
    PowerMockito.when(M_product.getEndTime()).thenReturn(ProductData.UTC.create(afterTime, 0));

    boolean result = _productValidator.isValid(M_product);

    assertEquals(false, result);
    verify(S_logger, times(1))
        .info(
            "Product skipped. The product 'ProductMock' is not inside the date range from 21-MAY-2012 00:00:00.000000 to 08-JUL-2012 00:00:00.000000");
  }