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

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

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

Assert.assertNull介绍

暂无

代码示例

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

/**
 * Creates the {@link DefaultRecordType} to be used by all tests in this class.
 */
@BeforeClass
public static void createRecordType() {
  final DefaultRecordSchema schema = new SerializableRecordSchema("MySchema");
  final Map<CharSequence,Class<?>> members = new LinkedHashMap<>(8);
  assertNull(members.put("city",       String.class));
  assertNull(members.put("latitude",   Double.class));
  assertNull(members.put("longitude",  Double.class));
  assertNull(members.put("population", Integer.class));
  recordType = schema.createRecordType("MyRecordType", members);
  SerializableRecordSchema.INSTANCE = schema;
}

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

/**
 * Creates an attribute type for city population.
 *
 * @param  identification  an empty temporary map (provided only for recycling existing instances).
 */
static DefaultAttributeType<Integer> population(final Map<String,Object> identification) {
  assertNull(identification.put(DefaultAttributeType.NAME_KEY, "population"));
  // We may add more properties here in a future version.
  final DefaultAttributeType<Integer> population = new DefaultAttributeType<>(
      identification, Integer.class, 1, 1, null);
  identification.clear();
  return population;
}

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

/**
 * Creates the example given in annex B of ISO 19112:2003.
 *
 * @param  inherit  {@code false} for defining all properties of all location types explicitly even
 *                  in case of redundancy, or {@code true} for relying on inheritance when possible.
 */
private static ReferencingByIdentifiers create(final boolean inherit) {
  final Map<String,Object> properties = new HashMap<>();
  assertNull(properties.put(ReferencingByIdentifiers.NAME_KEY, "UK property addressing"));
  assertNull(properties.put(ReferencingByIdentifiers.DOMAIN_OF_VALIDITY_KEY, new DefaultExtent("UK", null, null, null)));
  assertNull(properties.put(ReferencingByIdentifiers.THEME_KEY, "property"));
  assertNull(properties.put(ReferencingByIdentifiers.OVERALL_OWNER_KEY, new DefaultOrganisation("Office for National Statistics", null, null, null)));
  return new ReferencingByIdentifiers(properties, LocationTypeTest.create(inherit));
}

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

/**
 * Tests the {@link OptionKey#getValueFrom(Map)} and {@link OptionKey#setValueInto(Map, Object)}
 * methods with null arguments.
 */
@Test
public void testNullArguments() {
  assertNull(URL_ENCODING.getValueFrom(null));
  assertNull(URL_ENCODING.setValueInto(null, null));
}

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

/**
 * Execution of {@link #testExplicitSource2D()} and {@link #testImplicitSource2D()}
 * where all control points are specified by a map.
 */
private void testSetAllPoints(final LinearTransformBuilder builder) throws FactoryException {
  final Map<DirectPosition2D,DirectPosition2D> pos = new HashMap<>(8);
  assertNull(pos.put(new DirectPosition2D(0, 0), new DirectPosition2D(3, 9)));
  assertNull(pos.put(new DirectPosition2D(0, 1), new DirectPosition2D(4, 7)));
  assertNull(pos.put(new DirectPosition2D(0, 2), new DirectPosition2D(6, 6)));
  assertNull(pos.put(new DirectPosition2D(1, 0), new DirectPosition2D(4, 8)));
  assertNull(pos.put(new DirectPosition2D(1, 1), new DirectPosition2D(5, 4)));
  assertNull(pos.put(new DirectPosition2D(1, 2), new DirectPosition2D(8, 2)));
  builder.setControlPoints(pos);
  verify(builder);
}

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

/**
 * Tests {@link CRS#getTemporalComponent(CoordinateReferenceSystem)}.
 */
@Test
public void testGetTemporalComponent() {
  assertNull(CRS.getTemporalComponent(HardCodedCRS.ELLIPSOIDAL_HEIGHT));
  assertNull(CRS.getTemporalComponent(HardCodedCRS.WGS84));
  assertNull(CRS.getTemporalComponent(HardCodedCRS.WGS84_φλ));
  assertNull(CRS.getTemporalComponent(HardCodedCRS.WGS84_3D));
  assertSame(HardCodedCRS.TIME, CRS.getTemporalComponent(HardCodedCRS.TIME));
  assertSame(HardCodedCRS.TIME, CRS.getTemporalComponent(HardCodedCRS.GEOID_4D));
}

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

/**
 * Tests the {@link AbstractIdentifiedObject#AbstractIdentifiedObject(Map)} constructor without identifier.
 * This method compares the property values against the expected values.
 */
@Test
public void testWithoutIdentifier() {
  final Set<ReferenceIdentifier> identifiers = Collections.emptySet();
  final AbstractIdentifiedObject object      = new AbstractIdentifiedObject(properties(identifiers));
  final ReferenceIdentifier      gmlId       = validate(object, identifiers, "GRS1980");
  assertNull("gmlId", gmlId);
}

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

/**
   * Tests with UUIDs.
   */
  @Test
  public void testUUIDs() {
    final List<Identifier> identifiers = new ArrayList<>();
    final IdentifierMap map = new ModifiableIdentifierMap(identifiers);
    final java.util.UUID id1 = fromString("434f3107-c6d2-4c8c-bb25-553f68641c5c");
    final java.util.UUID id2 = fromString("42924124-032a-4dfe-b06e-113e3cb81cf0");

    // Add first UUID.
    assertNull(map.putSpecialized(UUID, id1));

    // Replace UUID by a new one.
    assertSame(id1, map.putSpecialized(UUID, id2));
  }
}

代码示例来源:origin: Geomatys/geotoolkit

/**
 * Tests the removal of keys from a hashmap. Required for {@link FactoryRegistry} working.
 */
@Test
public void testRemoval() {
  final Hints hints = new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);
  assertFalse(hints.isEmpty());
  Map<RenderingHints.Key,Object> map = new HashMap<>();
  assertNull(map.put(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.FALSE));
  map = Collections.unmodifiableMap(map);
  assertFalse(map.isEmpty());
  final Hints remaining = hints.clone();
  assertTrue(remaining.keySet().removeAll(map.keySet()));
  assertTrue(remaining.isEmpty());
}

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

/**
 * Tests {@link CRS#getHorizontalComponent(CoordinateReferenceSystem)}.
 */
@Test
@DependsOnMethod("testIsHorizontalCRS")
public void testGetHorizontalComponent() {
  assertNull(CRS.getHorizontalComponent(HardCodedCRS.TIME));
  assertNull(CRS.getHorizontalComponent(HardCodedCRS.ELLIPSOIDAL_HEIGHT));
  assertNull(CRS.getHorizontalComponent(HardCodedCRS.GEOCENTRIC));
  assertSame(HardCodedCRS.WGS84,    CRS.getHorizontalComponent(HardCodedCRS.WGS84));
  assertSame(HardCodedCRS.WGS84_φλ, CRS.getHorizontalComponent(HardCodedCRS.WGS84_φλ));
  assertEqualsIgnoreMetadata(HardCodedCRS.WGS84, CRS.getHorizontalComponent(HardCodedCRS.WGS84_3D));
}

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

/**
   * Tests {@link CoordinateSystems#getEpsgCode(Class, CoordinateSystemAxis...)}
   * with an ellipsoidal coordinate system.
   */
  @Test
  public void testGetEpsgCodeForCartesianCS() {
    final Class<CartesianCS> type = CartesianCS.class;
    final CoordinateSystemAxis E = HardCodedAxes.EASTING;
    final CoordinateSystemAxis W = HardCodedAxes.WESTING;
    final CoordinateSystemAxis N = HardCodedAxes.NORTHING;
    assertEquals(Integer.valueOf(4400), CoordinateSystems.getEpsgCode(type, E, N));
    assertEquals(Integer.valueOf(4500), CoordinateSystems.getEpsgCode(type, N, E));
    assertEquals(Integer.valueOf(4501), CoordinateSystems.getEpsgCode(type, N, W));
    assertNull(CoordinateSystems.getEpsgCode(type, HardCodedAxes.GEODETIC_LATITUDE, HardCodedAxes.GEODETIC_LONGITUDE));
  }
}

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

/**
 * Tests {@link MatrixParameters#indicesToAlias(int[])}.
 */
@Test
public void testIndicesToAlias() {
  assertEquals("K0", MatrixParameters.indicesToAlias(new int[] {10, 0}));
  assertEquals("A6", MatrixParameters.indicesToAlias(new int[] { 0, 6}));
  assertEquals("G4", MatrixParameters.indicesToAlias(new int[] { 6, 4}));
  assertNull(MatrixParameters.indicesToAlias(new int[] {27, 2}));
  assertNull(MatrixParameters.indicesToAlias(new int[] {2, 10}));
}

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

/**
 * Tests {@link MatrixParameters#aliasToIndices(String)}.
 */
@Test
public void testAliasToIndices() {
  assertArrayEquals(new int[] {10, 0}, MatrixParameters.aliasToIndices("K0"));
  assertArrayEquals(new int[] { 0, 6}, MatrixParameters.aliasToIndices("A6"));
  assertArrayEquals(new int[] { 6, 4}, MatrixParameters.aliasToIndices("G4"));
  assertNull(MatrixParameters.aliasToIndices("2B"));
  assertNull(MatrixParameters.aliasToIndices("elt_1_2"));
}

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

/**
 * Tests {@link UnitDimension#multiply(Dimension)}.
 */
@Test
@DependsOnMethod("testEqualsAndHashCode")
public void testMultiply() {
  assertSame(LENGTH, LENGTH.multiply(DIMENSIONLESS));
  assertSame(AREA,   LENGTH.multiply(LENGTH));
  assertSame(VOLUME, LENGTH.multiply(AREA));
  assertSame(VOLUME, AREA  .multiply(LENGTH));
  final Map<Dimension,Integer> expected = new HashMap<>(4);
  assertNull(expected.put(LENGTH, 1));
  assertNull(expected.put(TIME,   1));
  assertMapEquals(expected, LENGTH.multiply(TIME).getBaseDimensions());
}

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

/**
 * Tests {@link SystemUnit#multiply(Unit)}.
 */
@Test
@DependsOnMethod("testEqualsAndHashCode")
public void testMultiply() {
  assertSame(Units.METRE,        Units.METRE.multiply(Units.UNITY));
  assertSame(Units.SQUARE_METRE, Units.METRE.multiply(Units.METRE));
  assertSame(Units.CUBIC_METRE,  Units.METRE.multiply(Units.SQUARE_METRE));
  assertSame(Units.CUBIC_METRE,  Units.SQUARE_METRE.multiply(Units.METRE));
  final Map<Unit<?>,Integer> expected = new HashMap<>(4);
  assertNull(expected.put(Units.METRE,  1));
  assertNull(expected.put(Units.SECOND, 1));
  assertMapEquals(expected, Units.METRE.multiply(Units.SECOND).getBaseUnits());
}

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

/**
   * Tests serialization.
   */
  @Test
  @DependsOnMethod("testWithoutIdentifier")
  public void testSerialization() {
    final Set<ReferenceIdentifier> identifiers = Collections.emptySet();
    final AbstractIdentifiedObject object      = new AbstractIdentifiedObject(properties(identifiers));
    final AbstractIdentifiedObject actual      = assertSerializedEquals(object);
    assertNotSame(object, actual);
    assertNull("gmlId", validate(actual, identifiers, "GRS1980"));
  }
}

代码示例来源:origin: Geomatys/geotoolkit

/**
 * Tests the {@link Hints#toString} method.
 */
public void testToString() {
  final Hints hints = new Hints();
  assertNull(hints.put(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.FALSE));
  assertEquals("FORCE_LONGITUDE_FIRST_AXIS_ORDER = false", hints.toString().trim());
  assertEquals(hints.put(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE), Boolean.FALSE);
  assertEquals("FORCE_LONGITUDE_FIRST_AXIS_ORDER = true", hints.toString().trim());
  assertEquals(hints.remove(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER), Boolean.TRUE);
  assertEquals("", hints.toString().trim());
}

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

/**
   * Tests {@link DefaultTreeTable.Node#setValue(TableColumn, Object)}.
   */
  @Test
  public void testNodeValues() {
    final DefaultTreeTable table = new DefaultTreeTable(NAME, TYPE);
    final TreeTable.Node   node  = new DefaultTreeTable.Node(table);
    assertNull(node.getValue(NAME));
    assertNull(node.getValue(TYPE));
    node.setValue(NAME, "A number");
    node.setValue(TYPE, Number.class);
    assertEquals("A number",   node.getValue(NAME));
    assertEquals(Number.class, node.getValue(TYPE));
  }
}

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

/**
 * Tests the creation of {@link NilObject} instances.
 */
@Test
public void testCreateNilObject() {
  final Citation citation = NilReason.TEMPLATE.createNilObject(Citation.class);
  assertInstanceOf("Unexpected proxy.", NilObject.class, citation);
  assertNull(citation.getTitle());
  assertTrue(citation.getDates().isEmpty());
  assertEquals("NilObject.toString()", "Citation[template]", citation.toString());
  assertSame("NilReason.forObject(…)", NilReason.TEMPLATE, NilReason.forObject(citation));
  assertSame("Expected cached value.", citation, NilReason.TEMPLATE.createNilObject(Citation.class));
}

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

/**
 * Tests initialization to the default value.
 */
@Test
@DependsOnMethod("testValue")
public void testDefaultValue() {
  final AbstractAttribute<String> attribute = new MultiValuedAttribute<>(DefaultAttributeTypeTest.city());
  assertEquals     ("value",                "Utopia",  attribute.getValue());
  assertArrayEquals("values", new String[] {"Utopia"}, attribute.getValues().toArray());
  attribute.setValue("Atlantide");
  assertEquals     ("value",                "Atlantide",  attribute.getValue());
  assertArrayEquals("values", new String[] {"Atlantide"}, attribute.getValues().toArray());
  attribute.setValue(null);
  assertNull("value",  attribute.getValue());
  assertTrue("values", attribute.getValues().isEmpty());
}

相关文章