### Question:
TimeZoneEncoderImpl implements TimeZoneEncoder { @VisibleForTesting byte[] encodeName(String nameToEncode) { byte[] standardName = wcharEncoder.toByteArray(nameToEncode); return Arrays.copyOf(standardName, SPEC_NAMES_LENGHT); } @Inject  TimeZoneEncoderImpl(
			IntEncoder intEncoder, WCHAREncoder wcharEncoder, SystemTimeEncoder systemTimeEncoder); @Override byte[] encode(ASTimeZone asTimeZone);  }### Answer:
@Test public void testEncodeNameEmpty() { byte[] standardName = serializer.encodeName(""); assertThat(standardName).hasSize(SPEC_NAMES_LENGHT).isEqualTo(new byte[SPEC_NAMES_LENGHT]); }
@Test public void testEncodeNameIsFillWith0x0() { byte[] standardName = serializer.encodeName("a"); byte[] bytesForA = new byte[] {97, 0}; int spaceToBeFilledByZeroByte = SPEC_NAMES_LENGHT - bytesForA.length; byte[] expectedValue = Bytes.concat(bytesForA, new byte[spaceToBeFilledByZeroByte]); assertThat(standardName).hasSize(SPEC_NAMES_LENGHT).isEqualTo(expectedValue); }
@Test public void testEncodeNameAccept32Char() { String strOf32Char = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; byte[] encoded32char = strOf32Char.getBytes(Charsets.UTF_16LE); byte[] standardName = serializer.encodeName(new String(strOf32Char)); assertThat(standardName).hasSize(SPEC_NAMES_LENGHT).isEqualTo(encoded32char); }
@Test public void testEncodeNameTruncAt32Char() { String strOfMoreThan32Char = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; byte[] encodedMoreThan32Char = strOfMoreThan32Char.getBytes(Charsets.UTF_16LE); byte[] standardName = serializer.encodeName(new String(strOfMoreThan32Char)); byte[] expectedTruncatedValue = Arrays.copyOf(encodedMoreThan32Char, SPEC_NAMES_LENGHT); assertThat(standardName).hasSize(SPEC_NAMES_LENGHT).isEqualTo(expectedTruncatedValue); }