Utils { public static boolean validateName(String name) { return ASCII.canEncode(name) && !name.contains("/") && !name.contains("."); } private  Utils(); static String toHex(long address); static String readUntilNull(ByteBuffer buffer); static boolean validateName(String name); static void seekBufferToNextMultipleOfEight(ByteBuffer bb); static int readBytesAsUnsignedInt(ByteBuffer buffer, int length); static long readBytesAsUnsignedLong(ByteBuffer buffer, int length); static ByteBuffer createSubBuffer(ByteBuffer source, int length); static int bitsToInt(BitSet bits, int start, int length); static int bytesNeededToHoldNumber(long number); static int[] linearIndexToDimensionIndex(int index, int[] dimensions); static int dimensionIndexToLinearIndex(int[] index, int[] dimensions); static int[] chunkIndexToChunkOffset(int chunkIndex, int[] chunkDimensions, int[] datasetDimensions); static int[] stripLeadingIndex(int[] dims);  }
@Test void testValidNameReturnsTrue() { assertThat(Utils.validateName("hello"), is(true)); }
@Test void testNameContainingDotIsInvalid() { assertThat(Utils.validateName("hello."), is(false)); }
@Test void testNameContainingSlashIsInvalid() { assertThat(Utils.validateName("hello/"), is(false)); }
@Test void testNameContainingNonAsciiIsInvalid() { assertThat(Utils.validateName("helloμ"), is(false)); }