Skip to content

Commit 1a84bff

Browse files
authored
Tests directory cleanup. (#6)
1 parent cb5da70 commit 1a84bff

37 files changed

+295
-359
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,11 +445,11 @@ Let's look at an example:
445445

446446
```java
447447
@AerospikeSetter(name="bob")
448-
public void setCrazyness(int value) {
448+
public void setCraziness(int value) {
449449
unmapped = value/3;
450450
}
451451
@AerospikeGetter(name="bob")
452-
public int getCrazyness() {
452+
public int getCraziness() {
453453
return unmapped*3;
454454
}
455455
```

src/test/java/com/aerospike/mapper/AdTechUseCaseExampleTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public void adTechUseCase() {
106106
.withReadPolicy(readPolicy).forAll()
107107
.build();
108108

109-
User user = new User("User1", new Date(), new ArrayList<Segment>());
109+
User user = new User("User1", new Date(), new ArrayList<>());
110110
mapper.save(user);
111111

112112
// Create a virtual list pointing to the users' segments

src/test/java/com/aerospike/mapper/AeroMapperArrayTests.java

Lines changed: 174 additions & 175 deletions
Large diffs are not rendered by default.

src/test/java/com/aerospike/mapper/AeroMapperBaseTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,5 @@ public void compare(Object original, Object read, boolean showObjects) {
5555
} catch (JsonProcessingException jpe) {
5656
throw new RuntimeException(jpe);
5757
}
58-
5958
}
6059
}

src/test/java/com/aerospike/mapper/AeroMapperConfigurationYamlTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,5 +140,4 @@ public void testConvenienceMethods() throws Exception {
140140
ContainerClass container2 = mapper.read(ContainerClass.class, container.id);
141141
assertEquals(container, container2);
142142
}
143-
144143
}

src/test/java/com/aerospike/mapper/AeroMapperCustomConverterTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ public void setup() {
2727
client.truncate(null, NAMESPACE, "poker", null);
2828
}
2929

30-
public static enum Suit {
31-
CLUBS, DIAMONDS, HEARTS, SPADES;
30+
public enum Suit {
31+
CLUBS, DIAMONDS, HEARTS, SPADES
3232
}
3333

3434
@AerospikeRecord(namespace = NAMESPACE, set = "card")
@@ -90,7 +90,6 @@ public boolean equals(Object obj) {
9090
}
9191
}
9292

93-
9493
public static class CardConverter {
9594
@ToAerospike
9695
public String toAerospike(Card card) {

src/test/java/com/aerospike/mapper/AeroMapperDocExamples.java

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,18 @@
11
package com.aerospike.mapper;
22

3-
import static org.junit.Assert.fail;
4-
5-
import java.time.Duration;
6-
import java.time.Instant;
7-
import java.util.ArrayList;
8-
import java.util.Date;
9-
import java.util.HashMap;
10-
import java.util.List;
11-
import java.util.Map;
12-
13-
import org.junit.Before;
14-
import org.junit.Test;
15-
163
import com.aerospike.client.AerospikeException;
17-
import com.aerospike.mapper.annotations.AerospikeBin;
18-
import com.aerospike.mapper.annotations.AerospikeConstructor;
19-
import com.aerospike.mapper.annotations.AerospikeEmbed;
4+
import com.aerospike.mapper.annotations.*;
205
import com.aerospike.mapper.annotations.AerospikeEmbed.EmbedType;
21-
import com.aerospike.mapper.annotations.AerospikeKey;
22-
import com.aerospike.mapper.annotations.AerospikeOrdinal;
23-
import com.aerospike.mapper.annotations.AerospikeRecord;
24-
import com.aerospike.mapper.annotations.AerospikeReference;
256
import com.aerospike.mapper.annotations.AerospikeReference.ReferenceType;
26-
import com.aerospike.mapper.annotations.AerospikeVersion;
27-
import com.aerospike.mapper.annotations.ParamFrom;
287
import com.aerospike.mapper.tools.AeroMapper;
8+
import org.junit.Before;
9+
import org.junit.Test;
10+
11+
import java.time.Duration;
12+
import java.time.Instant;
13+
import java.util.*;
14+
15+
import static org.junit.Assert.fail;
2916

3017
public class AeroMapperDocExamples extends AeroMapperBaseTest {
3118

@@ -47,7 +34,6 @@ public static class Account {
4734
public Product product;
4835
}
4936

50-
5137
@Test
5238
public void runEmbed() {
5339
Product product = new Product();
@@ -198,9 +184,10 @@ public void testListOrdering() {
198184
}
199185
}
200186

201-
public static enum AccountType {
187+
public enum AccountType {
202188
SAVINGS, CHEQUING
203189
}
190+
204191
@AerospikeRecord(namespace = "test", set = "accounts")
205192
public static class Accounts {
206193
@AerospikeKey
@@ -224,7 +211,7 @@ public Accounts(int id, String name, AccountType type) {
224211
@AerospikeRecord(namespace = "test", set = "txns")
225212
public static class Transactions {
226213
public String txnId;
227-
@AerospikeOrdinal(value = 1)
214+
@AerospikeOrdinal()
228215
public Instant date;
229216
public double amt;
230217
public String merchant;
@@ -253,7 +240,6 @@ public void testAccounts() {
253240
System.out.println("done");
254241
}
255242

256-
257243
@AerospikeRecord(namespace = "test", set = "parent")
258244
public static class Parent {
259245
@AerospikeKey

src/test/java/com/aerospike/mapper/AeroMapperExample.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,23 @@
11
package com.aerospike.mapper;
22

3-
import java.util.ArrayList;
4-
import java.util.Date;
5-
import java.util.HashMap;
6-
import java.util.List;
7-
import java.util.Map;
8-
import java.util.function.Function;
9-
103
import com.aerospike.client.AerospikeClient;
114
import com.aerospike.client.IAerospikeClient;
125
import com.aerospike.client.Key;
13-
import com.aerospike.client.policy.Policy;
146
import com.aerospike.mapper.model.Account;
157
import com.aerospike.mapper.model.Person;
168
import com.aerospike.mapper.model.Product;
179
import com.aerospike.mapper.model.ProductType;
1810
import com.aerospike.mapper.tools.AeroMapper;
1911

12+
import java.util.*;
13+
import java.util.function.Function;
14+
2015
public class AeroMapperExample {
2116

2217
public static void main(String[] args) {
2318

2419
IAerospikeClient client = new AerospikeClient("localhost", 3000);
2520

26-
Policy readPolicy = new Policy();
2721
AeroMapper mapper = new AeroMapper.Builder(client)
2822
// The following lines are for performance reasons only, they are not required.
2923
.preLoadClass(Account.class)
@@ -99,7 +93,7 @@ public static void main(String[] args) {
9993

10094
Account otherAccount = new Account();
10195
otherAccount.setBalance(150);
102-
otherAccount.setCrazyness(22);
96+
otherAccount.setCraziness(22);
10397
otherAccount.setId(17);
10498
otherAccount.setProduct(product);
10599
otherAccount.setTitle("This is an account title");
@@ -122,7 +116,7 @@ public static void main(String[] args) {
122116
System.out.printf("Loaded person: %s\n", p1.toString());
123117

124118
Function<Person, Boolean> function = person -> {
125-
System.out.println(String.format("\n\n:::: %s ::::", person.getSsn()));
119+
System.out.printf("\n\n:::: %s ::::%n", person.getSsn());
126120
System.out.println(person.toString());
127121

128122
//mapper.delete(person);

src/test/java/com/aerospike/mapper/AeroMapperListOfObjectTransformTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ public static class OwningClass {
2020
@AerospikeKey
2121
private int id;
2222
@AerospikeEmbed(elementType = EmbedType.LIST)
23-
private List<OwnedClass> children;
23+
private final List<OwnedClass> children;
2424

2525
public OwningClass() {
2626
children = new ArrayList<>();
2727
}
2828
}
2929

30-
@AerospikeRecord(namespace = "", set = "")
30+
@AerospikeRecord()
3131
public static class OwnedClass {
3232
public String name;
3333
public int id;
@@ -60,6 +60,4 @@ public void test() {
6060

6161
mapper.save(owner);
6262
}
63-
64-
6563
}

src/test/java/com/aerospike/mapper/AeroMapperListTest.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void setup() {
2828
@AerospikeRecord(namespace = NAMESPACE, set = "testSet")
2929
public static class TestV1 {
3030
public int a;
31-
@AerospikeOrdinal(1)
31+
@AerospikeOrdinal()
3232
public int b;
3333
public int c;
3434
public int d;
@@ -38,7 +38,7 @@ public static class TestV1 {
3838
@AerospikeRecord(namespace = NAMESPACE, set = "testSet", version = 2)
3939
public static class TestV2 {
4040
public int a;
41-
@AerospikeOrdinal(1)
41+
@AerospikeOrdinal()
4242
public int b;
4343
@AerospikeVersion(max = 1)
4444
public int c;
@@ -52,7 +52,7 @@ public static class TestV2 {
5252
public static class TestV3 {
5353
@AerospikeVersion(max = 2)
5454
public int a;
55-
@AerospikeOrdinal(1)
55+
@AerospikeOrdinal()
5656
public int b;
5757
@AerospikeVersion(max = 1)
5858
public int c;
@@ -234,7 +234,5 @@ public void testConvenienceMethods() {
234234
assertEquals(value.b, value2.b);
235235
assertEquals(value.c, value2.c);
236236
assertEquals(value.d, value2.d);
237-
238237
}
239-
240238
}

0 commit comments

Comments
 (0)