Skip to content

Commit

Permalink
Joiner -> String.join, since JDK 1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmay authored and egonw committed Jan 1, 2022
1 parent 4d20c4f commit 9d7940b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

package org.openscience.cdk.depict;

import com.google.common.base.Joiner;
import com.google.common.xml.XmlEscapers;
import org.openscience.cdk.renderer.RendererModel;
import org.openscience.cdk.renderer.elements.Bounds;
Expand Down Expand Up @@ -356,7 +355,7 @@ private void visit(String id, String cls, LineElement elem) {
private void visit(MarkedElement elem) {
String id = elem.getId();
List<String> classes = elem.getClasses();
String cls = classes.isEmpty() ? null : Joiner.on(" ").join(classes);
String cls = classes.isEmpty() ? null : String.join(" ", classes);

IRenderingElement marked = elem.element();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

package org.openscience.cdk.renderer.generators.standard;

import com.google.common.base.Joiner;
import org.junit.Test;

import java.util.ArrayList;
Expand Down Expand Up @@ -145,7 +144,7 @@ public void reversingBrackets() {
List<String> tokens = new ArrayList<>();
assertTrue(AbbreviationLabel.parse("N(CH2CH2O)CH2", tokens));
AbbreviationLabel.reverse(tokens);
assertThat(Joiner.on("").join(tokens), is("H2C(OH2CH2C)N"));
assertThat(String.join("", tokens), is("H2C(OH2CH2C)N"));
}

@Test
Expand All @@ -154,15 +153,15 @@ public void reversingFormatPOOHOEt() {
assertTrue(AbbreviationLabel.parse("PO(OH)OEt", tokens));
AbbreviationLabel.reverse(tokens);
AbbreviationLabel.format(tokens);
assertThat(Joiner.on("").join(tokens), is("EtO(HO)OP"));
assertThat(String.join("", tokens), is("EtO(HO)OP"));
}

@Test
public void reversingBracketsWithNumbers() {
List<String> tokens = new ArrayList<>();
assertTrue(AbbreviationLabel.parse("B(OH)2", tokens));
AbbreviationLabel.reverse(tokens);
assertThat(Joiner.on("").join(tokens), is("(HO)2B"));
assertThat(String.join("", tokens), is("(HO)2B"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

package org.openscience.cdk.smiles;

import com.google.common.base.Joiner;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
Expand Down Expand Up @@ -139,7 +138,7 @@ static void test(String... inputs) throws Exception {
for (String input : inputs)
output.add(sg.create(sp.parseSmiles(input)));

org.hamcrest.MatcherAssert.assertThat(Joiner.on(".").join(inputs) + " were not canonicalised, outputs were " + output,
org.hamcrest.MatcherAssert.assertThat(String.join(".", inputs) + " were not canonicalised, outputs were " + output,
output.size(), is(1));

}
Expand Down

0 comments on commit 9d7940b

Please sign in to comment.