Skip to content

Commit

Permalink
HSEARCH-3034 Replace fest-assert with AssertJ
Browse files Browse the repository at this point in the history
  • Loading branch information
gsmet authored and yrodiere committed Mar 26, 2018
1 parent 655c559 commit 546d1b8
Show file tree
Hide file tree
Showing 96 changed files with 351 additions and 392 deletions.
4 changes: 2 additions & 2 deletions elasticsearch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert</artifactId>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import static org.easymock.EasyMock.capture;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.fest.assertions.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThat;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/
package org.hibernate.search.elasticsearch.test;

import static org.fest.assertions.Assertions.assertThat;
import static org.fest.assertions.MapAssert.entry;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.entry;

import java.lang.annotation.Annotation;
import java.util.Map;
Expand Down Expand Up @@ -105,9 +105,9 @@ public void renameParameter() {
TokenizerDefinition definition = translator.translate( annotation );

assertThat( definition.getParameters() ).as( "parameters" )
.includes( entry( "max_token_length", new JsonPrimitive( "5" ) ) );
.containsEntry( "max_token_length", new JsonPrimitive( "5" ) );
assertThat( definition.getParameters().keySet() ).as( "parameter names" )
.excludes( "maxTokenLength" );
.doesNotContain( "maxTokenLength" );
}

@Test
Expand Down Expand Up @@ -137,10 +137,10 @@ public void transformParameter() {
CharFilterDefinition definition = translator.translate( annotation );

assertThat( definition.getParameters() ).as( "parameters" )
.includes( entry(
.containsEntry(
"escaped_tags",
JsonBuilder.array().add( new JsonPrimitive( "foo" ) ).add( new JsonPrimitive( "bar" ) ).build()
) );
);
}

@Test
Expand All @@ -154,10 +154,10 @@ public void transformParameter_tokenizerClass() {
TokenFilterDefinition definition = translator.translate( annotation );

assertThat( definition.getParameters() ).as( "parameters" )
.includes( entry(
.containsEntry(
"tokenizer",
new JsonPrimitive( "whitespace" )
) );
);
}

@Test
Expand Down Expand Up @@ -187,10 +187,10 @@ public void transformParameter_singleElementArray() {
TokenFilterDefinition definition = translator.translate( annotation );

assertThat( definition.getParameters() ).as( "parameters" )
.includes( entry(
.containsEntry(
"patterns",
JsonBuilder.array().add( new JsonPrimitive( "foo" ) ).build()
) );
);
}

@Test
Expand All @@ -204,9 +204,9 @@ public void transformParameter_norwegianStemmer() {

assertThat( definition.getType() ).as( "type" ).isEqualTo( "stemmer" );
assertThat( definition.getParameters() ).as( "parameters" )
.includes( entry(
.containsEntry(
"name", new JsonPrimitive( "light_norwegian" )
) );
);
}

@Test
Expand All @@ -221,9 +221,9 @@ public void transformParameter_norwegianStemmer_bokmal() {

assertThat( definition.getType() ).as( "type" ).isEqualTo( "stemmer" );
assertThat( definition.getParameters() ).as( "parameters" )
.includes( entry(
.containsEntry(
"name", new JsonPrimitive( "light_norwegian" )
) );
);
}

@Test
Expand All @@ -238,9 +238,9 @@ public void transformParameter_norwegianStemmer_nynorsk() {

assertThat( definition.getType() ).as( "type" ).isEqualTo( "stemmer" );
assertThat( definition.getParameters() ).as( "parameters" )
.includes( entry(
.containsEntry(
"name", new JsonPrimitive( "light_nynorsk" )
) );
);
}

@Test
Expand Down Expand Up @@ -271,9 +271,9 @@ public void transformParameter_patternReplace() {
TokenFilterDefinition definition = translator.translate( annotation );

assertThat( definition.getParameters() ).as( "parameters" )
.includes( entry(
.containsEntry(
"all", new JsonPrimitive( "false" )
) );
);
}

@Test
Expand All @@ -291,28 +291,24 @@ public void transformParameter_cjkBigramIgnoredScripts() {
TokenFilterDefinition definition = translator.translate( annotation );

assertThat( definition.getParameters() ).as( "parameters" )
.includes(
entry(
"output_unigrams",
new JsonPrimitive( "true" )
)
.containsEntry(
"output_unigrams",
new JsonPrimitive( "true" )
);

assertThat( definition.getParameters() ).as( "parameters" )
.includes(
entry(
"ignored_scripts",
JsonBuilder.array()
.add( new JsonPrimitive( "han" ) )
.add( new JsonPrimitive( "hiragana" ) )
.add( new JsonPrimitive( "katakana" ) )
.add( new JsonPrimitive( "hangul" ) )
.build()
)
.containsEntry(
"ignored_scripts",
JsonBuilder.array()
.add( new JsonPrimitive( "han" ) )
.add( new JsonPrimitive( "hiragana" ) )
.add( new JsonPrimitive( "katakana" ) )
.add( new JsonPrimitive( "hangul" ) )
.build()
);

assertThat( definition.getParameters().keySet() ).as( "parameter names" )
.excludes( "han", "hiragana", "katakana", "hangul", "outputUnigrams" );
.doesNotContain( "han", "hiragana", "katakana", "hangul", "outputUnigrams" );
}

@Test
Expand Down Expand Up @@ -366,13 +362,13 @@ public void typeToken_whitelist() {

assertThat( definition.getType() ).as( "type" ).isEqualTo( "keep_types" );
assertThat( definition.getParameters() ).as( "parameters" )
.includes( entry(
.containsEntry(
"types",
JsonBuilder.array()
.add( new JsonPrimitive( "<FOO>" ) )
.add( new JsonPrimitive( "<BAR>" ) )
.build()
) );
);
// No other parameter is expected, particularly not "useWhitelist"
assertThat( definition.getParameters() ).as( "parameters" ).hasSize( 1 );
}
Expand All @@ -395,7 +391,7 @@ public void passThrough() {

assertThat( definition.getType() ).as( "type" ).isEqualTo( "foo" );
assertThat( definition.getParameters() ).as( "parameters" )
.includes(
.contains(
entry( "string", new JsonPrimitive( "foo" ) ),
entry( "boolean", new JsonPrimitive( true ) ),
entry( "integer", new JsonPrimitive( 42 ) ),
Expand All @@ -421,7 +417,7 @@ public void passThrough() {
)
);
assertThat( definition.getParameters().keySet() ).as( "parameters" )
.excludes( "type" );
.doesNotContain( "type" );
}

@Test
Expand All @@ -437,9 +433,9 @@ public void passThrough_stringWithoutQuotes() {

assertThat( definition.getType() ).as( "type" ).isEqualTo( "stringWithoutQuotes" );
assertThat( definition.getParameters() ).as( "parameters" )
.includes( entry( "param", new JsonPrimitive( "stringWithoutQuotes" ) ) );
.containsEntry( "param", new JsonPrimitive( "stringWithoutQuotes" ) );
assertThat( definition.getParameters().keySet() ).as( "parameters" )
.excludes( "type" );
.doesNotContain( "type" );
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
import static org.fest.assertions.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hibernate.search.test.util.impl.ExceptionMatcherBuilder.isException;

import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.fest.assertions.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThat;

import java.util.Properties;
import java.util.concurrent.CompletableFuture;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
*/
package org.hibernate.search.elasticsearch.test;

import static org.assertj.core.api.Assertions.assertThat;
import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.getCurrentArguments;
import static org.easymock.EasyMock.replay;
import static org.fest.assertions.Assertions.assertThat;

import java.util.Properties;

import org.assertj.core.api.AbstractCharSequenceAssert;
import org.easymock.Capture;
import org.easymock.EasyMock;
import org.easymock.EasyMockRunner;
import org.easymock.Mock;
import org.easymock.MockType;
import org.fest.assertions.StringAssert;
import org.hibernate.search.elasticsearch.client.impl.ElasticsearchClientFactory;
import org.hibernate.search.elasticsearch.client.impl.ElasticsearchClientImplementor;
import org.hibernate.search.elasticsearch.dialect.impl.ElasticsearchDialect;
Expand Down Expand Up @@ -106,7 +106,7 @@ public void propertyMasking() throws Exception {
assertProperty( maskedProperties, "default.elasticsearch.4" ).isEqualTo( "4" );
}

private StringAssert assertProperty(Properties maskedProperties, String name) {
private AbstractCharSequenceAssert<?, String> assertProperty(Properties maskedProperties, String name) {
return assertThat( maskedProperties.getProperty( name ) ).as( "Property from masked properties '" + name + "'" );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import org.fest.assertions.Assertions;
import org.assertj.core.api.Assertions;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hibernate.search.test.util.impl.ExceptionMatcherBuilder.isException;
Expand Down
4 changes: 2 additions & 2 deletions engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert</artifactId>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
package org.hibernate.search.test.analyzer.analyzerdef;

import static org.fest.assertions.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThat;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
package org.hibernate.search.test.analyzer.analyzerdefinitionprovider;

import static org.fest.assertions.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThat;

import org.apache.lucene.analysis.core.KeywordTokenizerFactory;
import org.apache.lucene.analysis.core.LowerCaseFilterFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
package org.hibernate.search.test.analyzer.analyzerdefs;

import static org.fest.assertions.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThat;

import java.util.LinkedHashSet;
import java.util.Set;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
package org.hibernate.search.test.bridge.time;

import static org.fest.assertions.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThat;

import java.time.Duration;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
package org.hibernate.search.test.bridge.time;

import static org.fest.assertions.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThat;

import java.time.Instant;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
package org.hibernate.search.test.bridge.time;

import static org.fest.assertions.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThat;

import java.time.LocalDate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
package org.hibernate.search.test.bridge.time;

import static org.fest.assertions.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThat;

import java.time.LocalDate;
import java.time.LocalDateTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
package org.hibernate.search.test.bridge.time;

import static org.fest.assertions.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThat;

import java.time.LocalTime;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
package org.hibernate.search.test.bridge.time;

import static org.fest.assertions.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThat;

import java.time.MonthDay;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
package org.hibernate.search.test.bridge.time;

import static org.fest.assertions.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThat;

import java.time.LocalDate;
import java.time.LocalDateTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
package org.hibernate.search.test.bridge.time;

import static org.fest.assertions.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThat;

import java.time.LocalTime;
import java.time.OffsetTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
package org.hibernate.search.test.bridge.time;

import static org.fest.assertions.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThat;

import java.time.Period;

Expand Down
Loading

0 comments on commit 546d1b8

Please sign in to comment.