SegmentRegistry { @NotNull public static Segment read( final int type, @NotNull final Buffer buffer) { final SegmentReader reader = readers.get(type); if (reader == null) { throw new NoSuchElementException( "No segment reader with type " + type); } return reader.read(buffer); } private  SegmentRegistry(); static void register(
            final int type,
            @NotNull
            final SegmentReader reader); @NotNull static Segment read(
            final int type,
            @NotNull
            final Buffer buffer);  }
@Test(expected = NoSuchElementException.class) public void notExisting() { final int ID = -1; SegmentRegistry.read(ID, Buffer.from(new byte[]{})); }