org.opengis.test.Assert.assertNull()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(16.0k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中org.opengis.test.Assert.assertNull()方法的一些代码示例,展示了Assert.assertNull()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.assertNull()方法的具体详情如下:
包路径:org.opengis.test.Assert
类名称:Assert
方法名:assertNull

Assert.assertNull介绍

暂无

代码示例

代码示例来源:origin: opengeospatial/geoapi

/**
 * Returns information about the configuration of the test which has been run.
 * This method returns a map containing:
 *
 * <ul>
 *   <li>All the following values associated to the {@link org.opengis.test.Configuration.Key} of the same name:
 *     <ul>
 *       <li>{@link #isValidationEnabled}</li>
 *       <li>{@link #crsFactory}</li>
 *     </ul>
 *   </li>
 * </ul>
 *
 * @return {@inheritDoc}
 */
@Override
public Configuration configuration() {
  final Configuration op = super.configuration();
  assertNull(op.put(Configuration.Key.isValidationEnabled, isValidationEnabled));
  assertNull(op.put(Configuration.Key.crsFactory,          crsFactory));
  return op;
}

代码示例来源:origin: opengeospatial/geoapi

/**
 * Returns information about the configuration of the test which has been run.
 * This method returns a map containing:
 *
 * <ul>
 *   <li>All the following values associated to the {@link org.opengis.test.Configuration.Key} of the same name:
 *     <ul>
 *       <li>{@link #isStandardNameSupported}</li>
 *       <li>{@link #isStandardAliasSupported}</li>
 *       <li>{@link #isDependencyIdentificationSupported}</li>
 *       <li>{@link #datumAuthorityFactory}</li>
 *       <li>{@link #crsAuthorityFactory}</li>
 *     </ul>
 *   </li>
 * </ul>
 *
 * @return the configuration of the test being run.
 */
@Override
public Configuration configuration() {
  final Configuration op = super.configuration();
  assertNull(op.put(Configuration.Key.datumAuthorityFactory, datumAuthorityFactory));
  assertNull(op.put(Configuration.Key.crsAuthorityFactory, crsAuthorityFactory));
  return op;
}

代码示例来源:origin: opengeospatial/geoapi

/**
 * Returns information about the configuration of the test which has been run.
 * This method returns a map containing:
 *
 * <ul>
 *   <li>All the following values associated to the {@link org.opengis.test.Configuration.Key} of the same name:
 *     <ul>
 *       <li>{@link #isMultiLocaleSupported}</li>
 *       <li>{@link #isMixedNameSyntaxSupported}</li>
 *     </ul>
 *   </li>
 * </ul>
 *
 * @return {@inheritDoc}
 */
@Override
public Configuration configuration() {
  final Configuration op = super.configuration();
  assertNull(op.put(Configuration.Key.isMultiLocaleSupported,     isMultiLocaleSupported));
  assertNull(op.put(Configuration.Key.isMixedNameSyntaxSupported, isMixedNameSyntaxSupported));
  return op;
}

代码示例来源:origin: opengeospatial/geoapi

/**
 * Returns information about the configuration of the test which has been run.
 * This method returns a map containing:
 *
 * <ul>
 *   <li>All the following values associated to the {@link org.opengis.test.Configuration.Key} of the same name:
 *     <ul>
 *       <li>{@link #isFactoryPreservingUserValues}</li>
 *       <li>{@linkplain #copFactory}</li>
 *     </ul>
 *   </li>
 * </ul>
 *
 * @return the configuration of the test being run.
 */
@Override
public Configuration configuration() {
  final Configuration op = super.configuration();
  assertNull(op.put(Configuration.Key.copFactory, copFactory));
  return op;
}

代码示例来源:origin: opengeospatial/geoapi

/**
 * Returns information about the configuration of the test which has been run.
 * This method returns a map containing:
 *
 * <ul>
 *   <li>All the following values associated to the {@link org.opengis.test.Configuration.Key} of the same name:
 *     <ul>
 *       <li>{@link #isStandardNameSupported}</li>
 *       <li>{@link #isStandardAliasSupported}</li>
 *       <li>{@link #isDependencyIdentificationSupported}</li>
 *       <li>{@link #crsAuthorityFactory}</li>
 *     </ul>
 *   </li>
 * </ul>
 *
 * @return the configuration of the test being run.
 */
@Override
public Configuration configuration() {
  final Configuration op = super.configuration();
  assertNull(op.put(Configuration.Key.crsAuthorityFactory, crsAuthorityFactory));
  return op;
}

代码示例来源:origin: opengeospatial/geoapi

/**
 * Returns information about the configuration of the test which has been run.
 * This method returns a map containing:
 *
 * <ul>
 *   <li>All the following values associated to the {@link org.opengis.test.Configuration.Key} of the same name:
 *     <ul>
 *       <li>{@link #isStandardNameSupported}</li>
 *       <li>{@link #isStandardAliasSupported}</li>
 *       <li>{@link #isDependencyIdentificationSupported}</li>
 *       <li>{@link #copAuthorityFactory}</li>
 *     </ul>
 *   </li>
 * </ul>
 *
 * @return the configuration of the test being run.
 */
@Override
public Configuration configuration() {
  final Configuration op = super.configuration();
  assertNull(op.put(Configuration.Key.copAuthorityFactory, copAuthorityFactory));
  return op;
}

代码示例来源:origin: org.opengis/geoapi-conformance

/**
 * Validates the given datum.
 *
 * @param object The object to validate, or {@code null}.
 */
public void validate(final TemporalDatum object) {
  if (object == null) {
    return;
  }
  validateIdentifiedObject(object);
  final Date origin = object.getOrigin();
  mandatory("TemporalDatum: expected an origin.", origin);
  assertNull("TemporalDatum: should not have anchor point.", object.getAnchorPoint());
  assertNull("TemporalDatum: should not have realization epoch.", object.getRealizationEpoch());
}

代码示例来源:origin: opengeospatial/geoapi

/**
 * Returns information about the configuration of the test which has been run.
 * This method returns a map containing:
 *
 * <ul>
 *   <li>All the following values associated to the {@link org.opengis.test.Configuration.Key} of the same name:
 *     <ul>
 *       <li>{@link #isStandardNameSupported}</li>
 *       <li>{@link #isStandardAliasSupported}</li>
 *       <li>{@link #isDependencyIdentificationSupported}</li>
 *       <li>{@link #copAuthorityFactory}</li>
 *     </ul>
 *   </li>
 * </ul>
 *
 * @return the configuration of the test being run.
 */
@Override
public Configuration configuration() {
  final Configuration op = super.configuration();
  assertNull(op.put(Configuration.Key.copAuthorityFactory, copAuthorityFactory));
  return op;
}

代码示例来源:origin: apache/sis

/**
 * Implementation of {@link #testToInternationalString()} using the given map implementation.
 */
private static void testToInternationalString(final Map<String,Object> properties) {
  assertNull(properties.put("name",       "Some name"));
  assertNull(properties.put("identifier", "Some identifier"));
  assertNull(properties.put("code",       "Some code"));
  assertNull(properties.put("codeSpace",  "Some code space"));
  assertNull(properties.put("authority",  "Some authority"));
  assertNull(properties.put("version",    "Some version"));
  assertNull(properties.put("remarks",    "Some remarks"));
  assertNull(Types.toInternationalString(properties, "dummy"));
  InternationalString i18n = Types.toInternationalString(properties, "remarks");
  assertInstanceOf("Single locale", SimpleInternationalString.class, i18n);
  assertEquals("Some remarks", i18n.toString());
  assertNull(properties.put("remarks_fr", "Une remarque"));
  i18n = Types.toInternationalString(properties, "remarks");
  assertInstanceOf("Two locales", DefaultInternationalString.class, i18n);
  assertEquals("Some remarks", i18n.toString(Locale.ROOT));
  assertEquals("Une remarque", i18n.toString(Locale.FRENCH));
  assertNotNull(properties.remove("remarks"));
  i18n = Types.toInternationalString(properties, "remarks");
  assertInstanceOf("Single locale", SimpleInternationalString.class, i18n);
  assertEquals("Une remarque", i18n.toString());
}

代码示例来源:origin: apache/sis

/**
 * Tests the {@link StorageConnector#getStorageAs(Class)} method for the {@link Connection} type.
 *
 * @throws DataStoreException if an error occurred while using the storage connector.
 * @throws IOException should never happen since we do not open any file.
 */
public void testGetAsConnection() throws DataStoreException, IOException {
  final StorageConnector connection = create(false);
  assertNull(connection.getStorageAs(Connection.class));
  connection.closeAllExcept(null);
}

代码示例来源:origin: apache/sis

/**
 * Tests {@link ShapeUtilities#intersectionPoint(double, double, double, double, double, double, double, double)}.
 */
@Test
public void testIntersectionPoint() {
  assertPointEquals(373.0459349536288,  153.4272907665677, ShapeUtilities.intersectionPoint(164, 261, 541,  67, 475, 214, 135,  12));
  assertPointEquals(164.2967949656081,  147.2610859066296, ShapeUtilities.intersectionPoint(  6, 259, 227, 103, 328, 254,  32,  61));
  assertPointEquals(206.18415613599478, 276.5596260282143, ShapeUtilities.intersectionPoint(549, 309, 158, 272, 495, 138, 174, 292));
  assertNull("Segments do not intersect.", ShapeUtilities.intersectionPoint( 52, 61, 419, 209, 419, 130, 529, 303));
  assertNull("Segments do not intersect.", ShapeUtilities.intersectionPoint( 53, 62, 222, 221, 494, 158, 382, 174));
  assertNull("Segments do not intersect.", ShapeUtilities.intersectionPoint(566, 296, 386, 305, 553, 51, 408, 291));
}

代码示例来源:origin: apache/sis

/**
 * Tests the {@link ValueMap#get(Object)} method.
 */
@Test
public void testGet() {
  final Map<String,Object> map = createCitation();
  assertEquals("Undercurrent",                 map.get("title").toString());
  assertEquals(singletonList(author),          map.get("citedResponsibleParties"));
  assertEquals("9782505004509",                map.get("ISBN"));
  assertNull  ("NilObject shall be excluded.", map.get("edition"));
  /*
   * The ISBN shall also be visible as an identifier.
   */
  final Object identifiers = map.get("identifiers");
  assertInstanceOf("identifiers", Collection.class, identifiers);
  final Object identifier = getSingleton((Collection<?>) identifiers);
  assertInstanceOf("identifier", Identifier.class, identifier);
  assertEquals("9782505004509", ((Identifier) identifier).getCode());
}

代码示例来源:origin: apache/sis

/**
 * Tests the {@link Types#getResources(String)} method.
 */
@Test
public void testGetResources() {
  assertEquals("org.opengis.metadata.Descriptions", Types.getResources("org.opengis.metadata.Identifier"));
  assertNull(Types.getResources("org.opengis.metadata2.Identifier"));
}

代码示例来源:origin: apache/sis

/**
 * Tests {@link ShapeUtilities#colinearPoint(double, double, double, double, double, double, double)}.
 */
@Test
public void testColinearPoint() {
  assertPointEquals(292.1838668370446,  278.764084678759,   ShapeUtilities.colinearPoint(214, 297, 587, 210, 104, 77, 275.902));
  assertPointEquals(151.57330058770097, 162.19277228964654, ShapeUtilities.colinearPoint(187,  93, 123, 218, 204, 16, 155.309));
  assertPointEquals(568.6671514383643,  274.6199927862288,  ShapeUtilities.colinearPoint(232,  84, 587, 285, 469, 31, 263.219));
  assertNull("No point at the given distance.", ShapeUtilities.colinearPoint(415, 112, 21,  269, 223, 270, 341.434));
  assertNull("No point at the given distance.", ShapeUtilities.colinearPoint(353, 235, 233, 104, 423,  81, 558.129));
}

代码示例来源:origin: apache/sis

/**
 * Verifies that {@link StorageConnector#getStorageAs(Class)} returns {@code null} for unavailable
 * target classes, and throws an exception for illegal target classes.
 *
 * @throws DataStoreException if an error occurred while using the storage connector.
 */
@Test
public void testGetInvalidObject() throws DataStoreException {
  final StorageConnector connection = create(true);
  assertNotNull("getStorageAs(InputStream.class)", connection.getStorageAs(InputStream.class));
  assertNull   ("getStorageAs(URI.class)",         connection.getStorageAs(URI.class));
  assertNull   ("getStorageAs(String.class)",      connection.getStorageAs(String.class));
  try {
    connection.getStorageAs(Float.class);       // Any unconvertible type.
    fail("Should not have accepted Float.class");
  } catch (UnconvertibleObjectException e) {
    final String message = e.getMessage();
    assertTrue(message, message.contains("Float"));
  }
  connection.closeAllExcept(null);
}

代码示例来源:origin: apache/sis

/**
   * Tests a category with a NaN value.
   */
  @Test
  public void testCategoryNaN() {
    final Category category = new Category("NaN", new NumberRange<>(Float.class, Float.NaN, true, Float.NaN, true), null, null, null);
    final NumberRange<?> range = category.getSampleRange();
    assertSame  ("converse",       category,   category.converse);
    assertEquals("name",           "NaN",      String.valueOf(category.name));
    assertEquals("name",           "NaN",      String.valueOf(category.getName()));
    assertEquals("minimum",        Double.NaN, category.minimum, STRICT);
    assertEquals("maximum",        Double.NaN, category.maximum, STRICT);
    assertNull  ("sampleRange",                category.range);
    assertEquals("range.minValue", Float.NaN,  range.getMinValue());
    assertEquals("range.maxValue", Float.NaN,  range.getMaxValue());
    assertFalse ("measurementRange",           category.getMeasurementRange().isPresent());
    assertFalse ("transferFunction",           category.getTransferFunction().isPresent());
    assertTrue  ("toConverse.isIdentity",      category.toConverse.isIdentity());
    assertFalse ("isQuantitative",             category.isQuantitative());
  }
}

代码示例来源:origin: apache/sis

/**
 * Tests the {@link Types#forEnumName(Class, String)} method with an enumeration from the JDK.
 * Such enumerations do not implement the {@code org.opengis.util.ControlledVocabulary} interface.
 *
 * @since 0.5
 */
@Test
public void testForStandardEnumName() {
  assertSame(ElementType.LOCAL_VARIABLE, Types.forEnumName(ElementType.class, "LOCAL_VARIABLE"));
  assertSame(ElementType.LOCAL_VARIABLE, Types.forEnumName(ElementType.class, "LOCALVARIABLE"));
  assertSame(ElementType.LOCAL_VARIABLE, Types.forEnumName(ElementType.class, "local variable"));
  assertSame(ElementType.LOCAL_VARIABLE, Types.forEnumName(ElementType.class, "local-variable"));
  assertNull(Types.forEnumName(ElementType.class, "variable"));
}

代码示例来源:origin: apache/sis

/**
 * Tests {@link NetcdfStoreProvider#probeContent(StorageConnector)} for a UCAR {@link NetcdfFile} object.
 *
 * @throws IOException if an error occurred while opening the netCDF file.
 * @throws DataStoreException if a logical error occurred.
 */
@Test
public void testProbeContentFromUCAR() throws IOException, DataStoreException {
  try (NetcdfFile file = createUCAR(TestData.NETCDF_2D_GEOGRAPHIC)) {
    final StorageConnector c = new StorageConnector(file);
    final NetcdfStoreProvider provider = new NetcdfStoreProvider();
    final ProbeResult probe = provider.probeContent(c);
    assertTrue  ("isSupported", probe.isSupported());
    assertEquals("getMimeType", NetcdfStoreProvider.MIME_TYPE, probe.getMimeType());
    assertNull  ("getVersion",  probe.getVersion());
  }
}

代码示例来源:origin: apache/sis

/**
 * Tests the {@link Types#forStandardName(String)} method.
 */
@Test
public void testForStandardName() {
  assertEquals(Citation     .class, Types.forStandardName("CI_Citation"));
  assertEquals(Datum        .class, Types.forStandardName("CD_Datum"));
  assertEquals(Citation     .class, Types.forStandardName("CI_Citation"));            // Value should be cached.
  assertEquals(Citation     .class, Types.forStandardName("Citation"));
  assertEquals(AxisDirection.class, Types.forStandardName("CS_AxisDirection"));
  assertNull  (                     Types.forStandardName("MD_Dummy"));
}

代码示例来源:origin: apache/sis

/**
 * Tests the {@link Types#forCodeName(Class, String, boolean)} method.
 */
@Test
public void testForCodeName() {
  assertSame(ImagingCondition.SEMI_DARKNESS, Types.forCodeName(ImagingCondition.class, "SEMI_DARKNESS", false));
  assertSame(ImagingCondition.SEMI_DARKNESS, Types.forCodeName(ImagingCondition.class, "SEMIDARKNESS",  false));
  assertSame(ImagingCondition.SEMI_DARKNESS, Types.forCodeName(ImagingCondition.class, "semi darkness", false));
  assertSame(ImagingCondition.SEMI_DARKNESS, Types.forCodeName(ImagingCondition.class, "semi-darkness", false));
  assertNull(Types.forCodeName(ImagingCondition.class, "darkness", false));
  assertSame(PixelInCell.CELL_CORNER, Types.forCodeName(PixelInCell.class, "cell corner", false));
  assertSame(PixelInCell.CELL_CORNER, Types.forCodeName(PixelInCell.class, "cellCorner",  false));
  assertSame(PixelInCell.CELL_CENTER, Types.forCodeName(PixelInCell.class, "cell center", false));
  assertSame(PixelInCell.CELL_CENTER, Types.forCodeName(PixelInCell.class, "cellCenter",  false));
  if (PENDING_NEXT_GEOAPI_RELEASE) {
    assertSame(PixelInCell.CELL_CENTER, Types.forCodeName(PixelInCell.class, "cell centre", false));
    assertSame(PixelInCell.CELL_CENTER, Types.forCodeName(PixelInCell.class, "cellCentre",  false));
  }
}

相关文章