Skip to content

Commit e7ed2c7

Browse files
committed
feat: update test structure
Signed-off-by: Otavio Santana <[email protected]>
1 parent ad6e269 commit e7ed2c7

File tree

5 files changed

+33
-33
lines changed

5 files changed

+33
-33
lines changed
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import java.util.Objects;
2323

2424
@Entity
25-
public class BirthdayPerson {
25+
public class Birthday {
2626

2727
@Id
2828
private String name;
@@ -39,21 +39,21 @@ public Integer getAge() {
3939
return age;
4040
}
4141

42-
public BirthdayPerson(String name, Integer age) {
42+
public Birthday(String name, Integer age) {
4343
this.name = name;
4444
this.age = age;
4545
}
4646

47-
public BirthdayPerson() {
47+
public Birthday() {
4848
}
4949

5050
@Override
5151
public boolean equals(Object o) {
5252
if (this == o) return true;
5353
if (o == null || getClass() != o.getClass()) return false;
54-
BirthdayPerson birthdayPerson = (BirthdayPerson) o;
55-
return Objects.equals(name, birthdayPerson.name) &&
56-
Objects.equals(age, birthdayPerson.age);
54+
Birthday birthday = (Birthday) o;
55+
return Objects.equals(name, birthday.name) &&
56+
Objects.equals(age, birthday.age);
5757
}
5858

5959
@Override

jnosql-mongodb/src/test/java/org/eclipse/jnosql/databases/mongodb/mapping/DefaultMongoDBTemplateTest.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void shouldReturnErrorOnDeleteMethod() {
9191
assertThrows(NullPointerException.class,() -> template.delete("Collection", null));
9292
assertThrows(NullPointerException.class,() -> template.delete((String) null, filter));
9393

94-
assertThrows(NullPointerException.class,() -> template.delete(BirthdayPerson.class, null));
94+
assertThrows(NullPointerException.class,() -> template.delete(Birthday.class, null));
9595
assertThrows(NullPointerException.class,() -> template.delete((Class<Object>) null, filter));
9696
}
9797

@@ -105,15 +105,15 @@ void shouldDeleteWithCollectionName() {
105105
@Test
106106
void shouldDeleteWithEntity() {
107107
Bson filter = eq("name", "Poliana");
108-
template.delete(BirthdayPerson.class, filter);
109-
Mockito.verify(manager).delete("BirthdayPerson", filter);
108+
template.delete(Birthday.class, filter);
109+
Mockito.verify(manager).delete("Birthday", filter);
110110
}
111111

112112
@Test
113113
void shouldDeleteAll() {
114-
EntityMetadata metadata = entities.get(BirthdayPerson.class);
114+
EntityMetadata metadata = entities.get(Birthday.class);
115115
DeleteQuery query = DeleteQuery.delete().from(metadata.name()).build();
116-
template.deleteAll(BirthdayPerson.class);
116+
template.deleteAll(Birthday.class);
117117
Mockito.verify(manager).delete(query);
118118
}
119119

@@ -126,21 +126,21 @@ void shouldReturnErrorOnSelectMethod() {
126126
assertThrows(NullPointerException.class, () -> template.select((String) null, filter));
127127

128128
assertThrows(NullPointerException.class, () -> template.select((Class<?>) null, null));
129-
assertThrows(NullPointerException.class, () -> template.select(BirthdayPerson.class, null));
129+
assertThrows(NullPointerException.class, () -> template.select(Birthday.class, null));
130130
assertThrows(NullPointerException.class, () -> template.select((Class<?>) null, filter));
131131
}
132132

133133
@Test
134134
void shouldSelectWithCollectionName() {
135-
var entity = CommunicationEntity.of("BirthdayPerson", Arrays
135+
var entity = CommunicationEntity.of("Birthday", Arrays
136136
.asList(Element.of("_id", "Poliana"),
137137
Element.of("age", 30)));
138138
Bson filter = eq("name", "Poliana");
139-
Mockito.when(manager.select("Person", filter))
139+
Mockito.when(manager.select("Birthday", filter))
140140
.thenReturn(Stream.of(entity));
141-
Stream<BirthdayPerson> stream = template.select("Person", filter);
141+
Stream<Birthday> stream = template.select("Birthday", filter);
142142
Assertions.assertNotNull(stream);
143-
BirthdayPerson poliana = stream.findFirst()
143+
Birthday poliana = stream.findFirst()
144144
.orElseThrow(() -> new IllegalStateException("There is an issue on the test"));
145145

146146
Assertions.assertNotNull(poliana);
@@ -150,15 +150,15 @@ void shouldSelectWithCollectionName() {
150150

151151
@Test
152152
void shouldSelectWithEntity() {
153-
var entity = CommunicationEntity.of("BirthdayPerson", Arrays
153+
var entity = CommunicationEntity.of("Birthday", Arrays
154154
.asList(Element.of("_id", "Poliana"),
155155
Element.of("age", 30)));
156156
Bson filter = eq("name", "Poliana");
157-
Mockito.when(manager.select("BirthdayPerson", filter))
157+
Mockito.when(manager.select("Birthday", filter))
158158
.thenReturn(Stream.of(entity));
159-
Stream<BirthdayPerson> stream = template.select(BirthdayPerson.class, filter);
159+
Stream<Birthday> stream = template.select(Birthday.class, filter);
160160
Assertions.assertNotNull(stream);
161-
BirthdayPerson poliana = stream.findFirst()
161+
Birthday poliana = stream.findFirst()
162162
.orElseThrow(() -> new IllegalStateException("There is an issue on the test"));
163163

164164
Assertions.assertNotNull(poliana);
@@ -188,8 +188,8 @@ void shouldReturnErrorOnAggregateMethod() {
188188
assertThrows(NullPointerException.class, () -> template.aggregate((String) null, pipeline));
189189
assertThrows(NullPointerException.class, () -> template.aggregate((String) null, pipelineArray));
190190
assertThrows(NullPointerException.class, () -> template.aggregate((String) null, bson));
191-
assertThrows(NullPointerException.class, () -> template.aggregate(BirthdayPerson.class, (List<Bson>) null));
192-
assertThrows(NullPointerException.class, () -> template.aggregate(BirthdayPerson.class, (Bson[]) null));
191+
assertThrows(NullPointerException.class, () -> template.aggregate(Birthday.class, (List<Bson>) null));
192+
assertThrows(NullPointerException.class, () -> template.aggregate(Birthday.class, (Bson[]) null));
193193

194194
}
195195

@@ -211,8 +211,8 @@ void shouldAggregateWithEntity() {
211211
Aggregates.group("$stars", Accumulators.sum("count", 1))
212212
};
213213

214-
template.aggregate(BirthdayPerson.class, predicates);
215-
Mockito.verify(manager).aggregate("BirthdayPerson", predicates);
214+
template.aggregate(Birthday.class, predicates);
215+
Mockito.verify(manager).aggregate("Birthday", predicates);
216216
}
217217

218218
@Test
@@ -228,9 +228,9 @@ void shouldCountByFilterWithCollectionName() {
228228
void shouldCountByFilterWithEntity() {
229229
var filter = eq("name", "Poliana");
230230

231-
template.count(BirthdayPerson.class, filter);
231+
template.count(Birthday.class, filter);
232232

233-
Mockito.verify(manager).count("BirthdayPerson", filter);
233+
Mockito.verify(manager).count("Birthday", filter);
234234
}
235235

236236
@Test
@@ -239,8 +239,8 @@ void shouldReturnErrorOnCountByFilterMethod() {
239239
assertThrows(NullPointerException.class, () -> template.count((String) null, null));
240240
assertThrows(NullPointerException.class, () -> template.count((String) null, filter));
241241
assertThrows(NullPointerException.class, () -> template.count("Person", null));
242-
assertThrows(NullPointerException.class, () -> template.count((Class<BirthdayPerson>) null, null));
243-
assertThrows(NullPointerException.class, () -> template.count((Class<BirthdayPerson>) null, filter));
244-
assertThrows(NullPointerException.class, () -> template.count(BirthdayPerson.class, null));
242+
assertThrows(NullPointerException.class, () -> template.count((Class<Birthday>) null, null));
243+
assertThrows(NullPointerException.class, () -> template.count((Class<Birthday>) null, filter));
244+
assertThrows(NullPointerException.class, () -> template.count(Birthday.class, null));
245245
}
246246
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
query.1=insert birthdayPerson {"_id": 1, "name": "Diana"}
2-
query.2=insert birthdayPerson {"_id": 2, "name": "Artemis"}
1+
query.1=insert birthday {"_id": 1, "name": "Diana"}
2+
query.2=insert birthday {"_id": 2, "name": "Artemis"}
33
id.name=_id
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
import jakarta.data.repository.Repository;
1919

2020
@Repository
21-
public interface PersonNoSQLRepository extends OracleNoSQLRepository<Human, String> {
21+
public interface HumanNoSQLRepository extends OracleNoSQLRepository<Human, String> {
2222
}

jnosql-oracle-nosql/src/test/java/org/eclipse/jnosql/databases/oracle/mapping/OracleDBExtensionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
public class OracleDBExtensionTest {
3939

4040
@Inject
41-
private PersonNoSQLRepository repository;
41+
private HumanNoSQLRepository repository;
4242

4343
@Test
4444
public void shouldSave() {

0 commit comments

Comments
 (0)