### Question:
WayBuilder extends GeometryBuilder<Way> { public Geometry build(Way entity) { try { Coordinate[] coords = coordinateCache.getAll(entity.getNodes()).stream().toArray(Coordinate[]::new); if (coords.length > 3 && coords[0].equals(coords[coords.length - 1])) { return geometryFactory.createPolygon(coords); } else if (coords.length > 1) { return geometryFactory.createLineString(coords); } else { return null; } } catch (CacheException e) { return null; } } @Inject  WayBuilder(GeometryFactory geometryFactory, Cache<Long, Coordinate> coordinateCache); Geometry build(Way entity);  }### Answer:
@Test public void build() { Geometry empty = WAY_BUILDER.build(WAY_0); assertNull(empty); Geometry linestring = WAY_BUILDER.build(WAY_1); assertTrue(linestring instanceof LineString); Geometry polygon = WAY_BUILDER.build(WAY_2); assertTrue(polygon instanceof Polygon); }