Skip to content

Commit 8e31198

Browse files
elharochingor13
authored andcommitted
test: add PercentEscaperTest (#957)
1 parent 9384459 commit 8e31198

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

google-http-client/src/main/java/com/google/api/client/util/escape/CharEscapers.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import java.io.UnsupportedEncodingException;
1818
import java.net.URLDecoder;
19-
import java.nio.ByteBuffer;
2019
import java.nio.charset.StandardCharsets;
2120

2221
/**
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright 2020 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5+
* in compliance with the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License
10+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11+
* or implied. See the License for the specific language governing permissions and limitations under
12+
* the License.
13+
*/
14+
15+
package com.google.api.client.util.escape;
16+
17+
import org.junit.Assert;
18+
import org.junit.Test;
19+
20+
public class PercentEscaperTest {
21+
22+
@Test
23+
public void testEscapeSpace() {
24+
PercentEscaper escaper =
25+
new PercentEscaper(PercentEscaper.SAFE_PLUS_RESERVED_CHARS_URLENCODER, false);
26+
String actual = escaper.escape("Hello there");
27+
Assert.assertEquals("Hello%20there", actual);
28+
}
29+
}

0 commit comments

Comments
 (0)