@Test public void testValidProduct() { boolean result = _productValidator.isValid(M_product); assertEquals(true, result); verifyNoMoreInteractions(S_logger); }
@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."); }
@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."); }
@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'."); }
@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."); }
@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."); }
@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"); }