Skip to content

Commit

Permalink
Add StandardCharsets support class and update TestBinaryDocument test…
Browse files Browse the repository at this point in the history
… to use that
  • Loading branch information
paulirwin committed Nov 17, 2024
1 parent e11efe8 commit 532d322
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Lucene.Net.Tests/Document/TestBinaryDocument.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using J2N.Text;
using Lucene.Net.Support;
using NUnit.Framework;
using System;
using System.Text;
Expand Down Expand Up @@ -108,7 +109,7 @@ public virtual void TestCompressionTools()
// fetch the binary compressed field and compare it's content with the original one
// LUCENENET: was `= new String(CompressionTools.decompress(docFromReader.getBinaryValue("binaryCompressed")), StandardCharsets.UTF_8);`
string binaryFldCompressedTest =
Encoding.UTF8.GetString(
StandardCharsets.UTF_8.GetString(
CompressionTools.Decompress(docFromReader.GetBinaryValue("binaryCompressed")));
Assert.IsTrue(binaryFldCompressedTest.Equals(binaryValCompressed, StringComparison.Ordinal));
Assert.IsTrue(
Expand Down
26 changes: 26 additions & 0 deletions src/Lucene.Net/Support/StandardCharsets.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF 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
*
* http://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.
*/

using Lucene.Net.Util;
using System.Text;

namespace Lucene.Net.Support;

internal static class StandardCharsets
{
public static readonly Encoding UTF_8 = IOUtils.CHARSET_UTF_8;
}

0 comments on commit 532d322

Please sign in to comment.