### Question:
Shape { public Shape(long... shape) { this( shape, Arrays.stream(shape).mapToObj(x -> LayoutType.UNKNOWN).toArray(LayoutType[]::new)); } Shape(long... shape);  Shape(List<Long> shape);  Shape(PairList<Long, LayoutType> shape);  Shape(long[] shape, String layout);  Shape(long[] shape, LayoutType[] layout); static Shape update(Shape shape, int dimension, long value); long[] getShape(); long get(int dimension); LayoutType getLayoutType(int dimension); long size(int... dimensions); long size(); int dimension(); long getUnknownValueCount(); Shape slice(int beginIndex); Shape slice(int beginIndex, int endIndex); Shape filterByLayoutType(Predicate<LayoutType> predicate); Shape map(Function<Pair<Long, LayoutType>, Pair<Long, LayoutType>> mapper); Stream<Pair<Long, LayoutType>> stream(); Shape add(long... axes); Shape addAll(Shape other); long head(); int getTrailingOnes(); int getLeadingOnes(); boolean isScalar(); boolean hasZeroDimension(); boolean isLayoutKnown(); LayoutType[] getLayout(); String toLayoutString(); byte[] getEncoded(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static Shape decode(DataInputStream dis);  }### Answer:
@Test public void shapeTest() { Shape shape = new Shape(1, 3, 224, 224); Assert.assertEquals(shape.getShape(), new long[] {1, 3, 224, 224}); Assert.assertThrows(IllegalArgumentException.class, () -> shape.size(-1)); Assert.assertEquals(shape.size(0, 1), 3); Assert.assertEquals(shape.size(), 150528); Assert.assertEquals(shape.dimension(), 4); Assert.assertEquals(shape.slice(1), new Shape(3, 224, 224)); Assert.assertEquals(shape.head(), 1); Assert.assertEquals(shape.toString(), "(1, 3, 224, 224)"); Assert.assertEquals(shape.getTrailingOnes(), 0); Assert.assertEquals(shape.getLeadingOnes(), 1); }