Skip to content

Commit

Permalink
HSEARCH-3613 Remove getters from mapper-pojo-base tests unless they'r…
Browse files Browse the repository at this point in the history
…e absolutely necessary

That's that much less code.
  • Loading branch information
yrodiere authored and fax4ever committed Sep 3, 2020
1 parent 2d12962 commit 86c7bad
Show file tree
Hide file tree
Showing 81 changed files with 808 additions and 3,830 deletions.
Expand Up @@ -86,15 +86,15 @@ public void default_associationInverseSideKnown() {
backendMock.verifyExpectationsMet();

ParentEntity parent = new ParentEntity();
parent.setId( 1 );
parent.setValue( "val1" );
parent.id = 1;
parent.value = "val1";

ChildEntity child = new ChildEntity();
child.setId( 2 );
child.setValue( "val2" );
child.id = 2;
child.value = "val2";

parent.setChild( child );
child.setParent( parent );
parent.child = child;
child.parent = parent;

// Test indexed-embedding
try ( SearchSession session = mapping.createSession() ) {
Expand Down Expand Up @@ -220,15 +220,15 @@ public void no_associationInverseSideUnknown() {
backendMock.verifyExpectationsMet();

ParentEntity parent = new ParentEntity();
parent.setId( 1 );
parent.setValue( "val1" );
parent.id = 1;
parent.value = "val1";

ChildEntity child = new ChildEntity();
child.setId( 2 );
child.setValue( "val2" );
child.id = 2;
child.value = "val2";

parent.setChild( child );
child.setParent( parent );
parent.child = child;
child.parent = parent;

// Test indexed-embedding
try ( SearchSession session = mapping.createSession() ) {
Expand Down Expand Up @@ -264,29 +264,6 @@ public static final class ParentEntity {
private String value;
private ChildEntity child;

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public String getValue() {
return value;
}

public void setValue(String value) {
this.value = value;
}

public ChildEntity getChild() {
return child;
}

public void setChild(ChildEntity child) {
this.child = child;
}
}

public static final class ChildEntity {
Expand All @@ -297,29 +274,6 @@ public static final class ChildEntity {
private String value;
private ParentEntity parent;

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public String getValue() {
return value;
}

public void setValue(String value) {
this.value = value;
}

public ParentEntity getParent() {
return parent;
}

public void setParent(ParentEntity parent) {
this.parent = parent;
}
}

}
Expand Up @@ -53,17 +53,11 @@ public void multipleFailuresSameContext() {
final String indexName = "indexName";
@Indexed(index = indexName)
class IndexedEntity {
Integer id;
Integer myProperty;
@DocumentId
public Integer getId() {
return id;
}
Integer id;
@GenericField(name = "failingField1")
@GenericField(name = "failingField2")
public Integer getMyProperty() {
return myProperty;
}
Integer myProperty;
}
String field1FailureMessage = "This is the failure message for field 1";
String field2FailureMessage = "This is the failure message for field 2";
Expand Down Expand Up @@ -115,21 +109,12 @@ public void multipleFailuresMultipleProperties() {
final String indexName = "indexName";
@Indexed(index = indexName)
class IndexedEntity {
Integer id;
Integer myProperty1;
Integer myProperty2;
@DocumentId
public Integer getId() {
return id;
}
Integer id;
@GenericField(name = "failingField1")
public Integer getMyProperty1() {
return myProperty1;
}
Integer myProperty1;
@GenericField(name = "failingField2")
public Integer getMyProperty2() {
return myProperty2;
}
Integer myProperty2;
}
String field1FailureMessage = "This is the failure message for field 1";
String field2FailureMessage = "This is the failure message for field 2";
Expand Down Expand Up @@ -183,30 +168,18 @@ public void multipleFailuresMultipleTypes() {
final String indexName1 = "indexName1";
@Indexed(index = indexName1)
class IndexedEntity1 {
Integer id;
Integer myProperty1;
@DocumentId
public Integer getId() {
return id;
}
Integer id;
@GenericField(name = "failingField1")
public Integer getMyProperty1() {
return myProperty1;
}
Integer myProperty1;
}
final String indexName2 = "indexName2";
@Indexed(index = indexName2)
class IndexedEntity2 {
Integer id;
Integer myProperty2;
@DocumentId
public Integer getId() {
return id;
}
Integer id;
@GenericField(name = "failingField2")
public Integer getMyProperty2() {
return myProperty2;
}
Integer myProperty2;
}
String field1FailureMessage = "This is the failure message for field 1";
String field2FailureMessage = "This is the failure message for field 2";
Expand Down Expand Up @@ -257,17 +230,11 @@ public void failuresFromBackend() {
final String indexName = "indexName";
@Indexed(index = indexName)
class IndexedEntity {
Integer id;
Integer myProperty;
@DocumentId
public Integer getId() {
return id;
}
Integer id;
@GenericField(name = "failingField1")
@GenericField(name = "failingField2")
public Integer getMyProperty() {
return myProperty;
}
Integer myProperty;
}
String field1FailureMessage = "This is the failure message for field 1";
String field2FailureMessage = "This is the failure message for field 2";
Expand Down
Expand Up @@ -460,53 +460,6 @@ public static class IndexedEntity {

private IndexedEntity otherEmbedding;

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public String getText() {
return text;
}

public void setText(String text) {
this.text = text;
}

public IndexedEntity getEmbedded() {
return embedded;
}

public void setEmbedded(IndexedEntity embedded) {
this.embedded = embedded;
}

public IndexedEntity getOtherEmbedded() {
return otherEmbedded;
}

public void setOtherEmbedded(IndexedEntity otherEmbedded) {
this.otherEmbedded = otherEmbedded;
}

public IndexedEntity getEmbedding() {
return embedding;
}

public void setEmbedding(IndexedEntity embedding) {
this.embedding = embedding;
}

public IndexedEntity getOtherEmbedding() {
return otherEmbedding;
}

public void setOtherEmbedding(IndexedEntity otherEmbedding) {
this.otherEmbedding = otherEmbedding;
}
}

public static final class OtherIndexedEntity {
Expand All @@ -516,21 +469,6 @@ public static final class OtherIndexedEntity {

private String text;

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public String getText() {
return text;
}

public void setText(String text) {
this.text = text;
}
}

private static class SimulatedFailure extends RuntimeException {
Expand Down
Expand Up @@ -44,29 +44,14 @@ public class AlternativeBinderIT {
public void smoke() {
@Indexed(index = INDEX_NAME)
class IndexedEntity {
Integer id;
Language language;
String title;
String text;
@DocumentId
public Integer getId() {
return id;
}

Integer id;
@AlternativeDiscriminator
public Language getLanguage() {
return language;
}

Language language;
@MultiLanguageField(projectable = Projectable.YES)
public String getTitle() {
return title;
}

String title;
@MultiLanguageField(name = "content")
public String getText() {
return text;
}
String text;
}

backendMock.expectSchema( INDEX_NAME, b -> b
Expand Down Expand Up @@ -118,28 +103,13 @@ public String getText() {
public void discriminator_missing() {
@Indexed(index = INDEX_NAME)
class IndexedEntity {
@DocumentId
Integer id;
Language language;
String title;
String text;
@DocumentId
public Integer getId() {
return id;
}

public Language getLanguage() {
return language;
}

@MultiLanguageField(projectable = Projectable.YES)
public String getTitle() {
return title;
}

String title;
@MultiLanguageField(name = "content")
public String getText() {
return text;
}
String text;
}

assertThatThrownBy( () -> setupHelper.start().setup( IndexedEntity.class ) )
Expand All @@ -158,35 +128,16 @@ public String getText() {
public void discriminator_conflict() {
@Indexed(index = INDEX_NAME)
class IndexedEntity {
Integer id;
Language language;
Language otherLanguage;
String title;
String text;
@DocumentId
public Integer getId() {
return id;
}

Integer id;
@AlternativeDiscriminator
public Language getLanguage() {
return language;
}

Language language;
@AlternativeDiscriminator
public Language getOtherLanguage() {
return otherLanguage;
}

Language otherLanguage;
@MultiLanguageField(projectable = Projectable.YES)
public String getTitle() {
return title;
}

String title;
@MultiLanguageField(name = "content")
public String getText() {
return text;
}
String text;
}

assertThatThrownBy( () -> setupHelper.start().setup( IndexedEntity.class ) )
Expand Down

0 comments on commit 86c7bad

Please sign in to comment.