### Question:
MapFileWriter { static int writeHeaderBuffer(final MapWriterConfiguration configuration, final TileBasedDataProcessor dataProcessor, final ByteBuffer containerHeaderBuffer) { LOGGER.fine("writing header"); LOGGER.fine("Bounding box for file: " + dataProcessor.getBoundingBox().toString()); byte[] magicBytes = MAGIC_BYTE.getBytes(UTF8_CHARSET); containerHeaderBuffer.put(magicBytes); int headerSizePosition = containerHeaderBuffer.position(); containerHeaderBuffer.putInt(DUMMY_INT); containerHeaderBuffer.putInt(configuration.getFileSpecificationVersion()); containerHeaderBuffer.putLong(DUMMY_LONG); containerHeaderBuffer.putLong(System.currentTimeMillis()); containerHeaderBuffer.putInt(LatLongUtils.degreesToMicrodegrees(dataProcessor.getBoundingBox().minLatitude)); containerHeaderBuffer.putInt(LatLongUtils.degreesToMicrodegrees(dataProcessor.getBoundingBox().minLongitude)); containerHeaderBuffer.putInt(LatLongUtils.degreesToMicrodegrees(dataProcessor.getBoundingBox().maxLatitude)); containerHeaderBuffer.putInt(LatLongUtils.degreesToMicrodegrees(dataProcessor.getBoundingBox().maxLongitude)); containerHeaderBuffer.putShort((short) Constants.DEFAULT_TILE_SIZE); writeUTF8(PROJECTION, containerHeaderBuffer); containerHeaderBuffer.put(infoByteOptmizationParams(configuration)); LatLong mapStartPosition = configuration.getMapStartPosition(); if (mapStartPosition != null) { containerHeaderBuffer.putInt(LatLongUtils.degreesToMicrodegrees(mapStartPosition.latitude)); containerHeaderBuffer.putInt(LatLongUtils.degreesToMicrodegrees(mapStartPosition.longitude)); } if (configuration.hasMapStartZoomLevel()) { containerHeaderBuffer.put((byte) configuration.getMapStartZoomLevel()); } if (configuration.getPreferredLanguage() != null) { writeUTF8(configuration.getPreferredLanguage(), containerHeaderBuffer); } if (configuration.getComment() != null) { writeUTF8(configuration.getComment(), containerHeaderBuffer); } writeUTF8(configuration.getWriterVersion(), containerHeaderBuffer); containerHeaderBuffer.putShort((short) configuration.getTagMapping().getOptimizedPoiIds().size()); for (short tagId : configuration.getTagMapping().getOptimizedPoiIds().keySet()) { OSMTag tag = configuration.getTagMapping().getPoiTag(tagId); writeUTF8(tag.tagKey(), containerHeaderBuffer); } containerHeaderBuffer.putShort((short) configuration.getTagMapping().getOptimizedWayIds().size()); for (short tagId : configuration.getTagMapping().getOptimizedWayIds().keySet()) { OSMTag tag = configuration.getTagMapping().getWayTag(tagId); writeUTF8(tag.tagKey(), containerHeaderBuffer); } int numberOfZoomIntervals = dataProcessor.getZoomIntervalConfiguration().getNumberOfZoomIntervals(); containerHeaderBuffer.put((byte) numberOfZoomIntervals); containerHeaderBuffer.mark(); containerHeaderBuffer.position(containerHeaderBuffer.position() + SIZE_ZOOMINTERVAL_CONFIGURATION * numberOfZoomIntervals); int headerSize = containerHeaderBuffer.position() - headerSizePosition - BYTES_INT; containerHeaderBuffer.putInt(headerSizePosition, headerSize); return containerHeaderBuffer.position(); } private  MapFileWriter(); static void writeFile(MapWriterConfiguration configuration, TileBasedDataProcessor dataProcessor);  }### Answer:
@Test public void testWriteHeaderBuffer() { ByteBuffer headerBuffer = ByteBuffer.allocate(MapFileWriter.HEADER_BUFFER_SIZE); int headerLength = MapFileWriter.writeHeaderBuffer(this.configuration, this.dataProcessor, headerBuffer); Assert.assertEquals(219, headerLength); }