AsciiStringCharacterTest.java — netty Source File
Architecture documentation for AsciiStringCharacterTest.java, a java file in the netty codebase.
Entity Profile
Relationship Graph
Source Code
/*
* Copyright 2014 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.util;
import org.junit.jupiter.api.Test;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.util.Random;
import static io.netty.util.AsciiString.contains;
import static io.netty.util.AsciiString.containsIgnoreCase;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Test character encoding and case insensitivity for the {@link AsciiString} class
*/
public class AsciiStringCharacterTest {
private static final Random r = new Random();
@Test
public void testContentEqualsIgnoreCase() {
byte[] bytes = { 32, 'a' };
AsciiString asciiString = new AsciiString(bytes, 1, 1, false);
// https://github.com/netty/netty/issues/9475
assertFalse(asciiString.contentEqualsIgnoreCase("b"));
assertFalse(asciiString.contentEqualsIgnoreCase(AsciiString.of("b")));
}
@Test
public void testGetBytesStringBuilder() {
final StringBuilder b = new StringBuilder();
for (int i = 0; i < 1 << 16; ++i) {
b.append("eéaà");
}
final String bString = b.toString();
final Charset[] charsets = CharsetUtil.values();
for (int i = 0; i < charsets.length; ++i) {
final Charset charset = charsets[i];
byte[] expected = bString.getBytes(charset);
byte[] actual = new AsciiString(b, charset).toByteArray();
assertArrayEquals(expected, actual, "failure for " + charset);
}
// ... (494 more lines)
Domain
Subdomains
Classes
Source
Frequently Asked Questions
What does AsciiStringCharacterTest.java do?
AsciiStringCharacterTest.java is a source file in the netty codebase, written in java. It belongs to the Buffer domain, Search subdomain.
Where is AsciiStringCharacterTest.java in the architecture?
AsciiStringCharacterTest.java is located at common/src/test/java/io/netty/util/AsciiStringCharacterTest.java (domain: Buffer, subdomain: Search, directory: common/src/test/java/io/netty/util).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free