Skip to content

Commit 712ee09

Browse files
committed
changed changed formatter of org.msgpack.type.*.java in src/test
1 parent f6ec048 commit 712ee09

3 files changed

Lines changed: 113 additions & 71 deletions

File tree

src/test/java/org/msgpack/type/ProxyValue.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
import org.msgpack.packer.Packer;
66

77
public abstract class ProxyValue implements Value {
8-
public ProxyValue() { }
8+
public ProxyValue() {
9+
}
910

1011
protected abstract Value getValue();
1112

@@ -108,4 +109,3 @@ public boolean equals(Object o) {
108109
return getValue().equals(o);
109110
}
110111
}
111-

src/test/java/org/msgpack/type/TestEquals.java

Lines changed: 111 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import org.msgpack.type.Value;
1010
import org.msgpack.type.ValueFactory;
1111

12-
1312
public class TestEquals extends TestSet {
1413
@Override
1514
public void testBoolean(boolean v) throws Exception {
@@ -22,7 +21,7 @@ public void testBoolean(boolean v) throws Exception {
2221
public void testBooleanArray(boolean[] v) throws Exception {
2322
Value[] vs1 = new Value[v.length];
2423
Value[] vs2 = new Value[v.length];
25-
for(int i=0; i < v.length; i++) {
24+
for (int i = 0; i < v.length; i++) {
2625
vs1[i] = ValueFactory.createBooleanValue(v[i]);
2726
vs2[i] = ValueFactory.createBooleanValue(v[i]);
2827
}
@@ -62,65 +61,103 @@ public void testDouble(double v) throws Exception {
6261
@Test
6362
public void testMapOrder() throws Exception {
6463
Value v1 = ValueFactory.createMapValue(new Value[] {
65-
ValueFactory.createRawValue("k0"), ValueFactory.createNilValue(),
66-
ValueFactory.createRawValue("k1"), ValueFactory.createRawValue("v1"),
67-
ValueFactory.createRawValue("k2"), ValueFactory.createRawValue("v2"),
68-
ValueFactory.createRawValue("k3"), ValueFactory.createRawValue("v3"),
69-
ValueFactory.createRawValue("k4"), ValueFactory.createRawValue("v4"),
70-
ValueFactory.createRawValue("k5"), ValueFactory.createRawValue("v5"),
71-
ValueFactory.createRawValue("k6"), ValueFactory.createRawValue("v6"),
72-
ValueFactory.createRawValue("k7"), ValueFactory.createRawValue("v7"),
73-
ValueFactory.createRawValue("k8"), ValueFactory.createRawValue("v8"),
74-
ValueFactory.createRawValue("k9"), ValueFactory.createRawValue("v9"),
75-
ValueFactory.createRawValue("k10"), ValueFactory.createRawValue("v10"),
76-
ValueFactory.createRawValue("k11"), ValueFactory.createRawValue("v11"),
77-
ValueFactory.createRawValue("k12"), ValueFactory.createRawValue("v12"),
78-
ValueFactory.createRawValue("k13"), ValueFactory.createRawValue("v13"),
79-
ValueFactory.createRawValue("k14"), ValueFactory.createRawValue("v14"),
80-
ValueFactory.createRawValue("k15"), ValueFactory.createRawValue("v15"),
81-
ValueFactory.createRawValue("k16"), ValueFactory.createRawValue("v16"),
82-
ValueFactory.createRawValue("k17"), ValueFactory.createRawValue("v17"),
83-
ValueFactory.createRawValue("k18"), ValueFactory.createRawValue("v18"),
84-
ValueFactory.createRawValue("k19"), ValueFactory.createRawValue("v19"),
85-
});
64+
ValueFactory.createRawValue("k0"),
65+
ValueFactory.createNilValue(),
66+
ValueFactory.createRawValue("k1"),
67+
ValueFactory.createRawValue("v1"),
68+
ValueFactory.createRawValue("k2"),
69+
ValueFactory.createRawValue("v2"),
70+
ValueFactory.createRawValue("k3"),
71+
ValueFactory.createRawValue("v3"),
72+
ValueFactory.createRawValue("k4"),
73+
ValueFactory.createRawValue("v4"),
74+
ValueFactory.createRawValue("k5"),
75+
ValueFactory.createRawValue("v5"),
76+
ValueFactory.createRawValue("k6"),
77+
ValueFactory.createRawValue("v6"),
78+
ValueFactory.createRawValue("k7"),
79+
ValueFactory.createRawValue("v7"),
80+
ValueFactory.createRawValue("k8"),
81+
ValueFactory.createRawValue("v8"),
82+
ValueFactory.createRawValue("k9"),
83+
ValueFactory.createRawValue("v9"),
84+
ValueFactory.createRawValue("k10"),
85+
ValueFactory.createRawValue("v10"),
86+
ValueFactory.createRawValue("k11"),
87+
ValueFactory.createRawValue("v11"),
88+
ValueFactory.createRawValue("k12"),
89+
ValueFactory.createRawValue("v12"),
90+
ValueFactory.createRawValue("k13"),
91+
ValueFactory.createRawValue("v13"),
92+
ValueFactory.createRawValue("k14"),
93+
ValueFactory.createRawValue("v14"),
94+
ValueFactory.createRawValue("k15"),
95+
ValueFactory.createRawValue("v15"),
96+
ValueFactory.createRawValue("k16"),
97+
ValueFactory.createRawValue("v16"),
98+
ValueFactory.createRawValue("k17"),
99+
ValueFactory.createRawValue("v17"),
100+
ValueFactory.createRawValue("k18"),
101+
ValueFactory.createRawValue("v18"),
102+
ValueFactory.createRawValue("k19"),
103+
ValueFactory.createRawValue("v19"), });
86104
Value v2 = ValueFactory.createMapValue(new Value[] {
87-
ValueFactory.createRawValue("k3"), ValueFactory.createRawValue("v3"),
88-
ValueFactory.createRawValue("k11"), ValueFactory.createRawValue("v11"),
89-
ValueFactory.createRawValue("k4"), ValueFactory.createRawValue("v4"),
90-
ValueFactory.createRawValue("k10"), ValueFactory.createRawValue("v10"),
91-
ValueFactory.createRawValue("k5"), ValueFactory.createRawValue("v5"),
92-
ValueFactory.createRawValue("k6"), ValueFactory.createRawValue("v6"),
93-
ValueFactory.createRawValue("k15"), ValueFactory.createRawValue("v15"),
94-
ValueFactory.createRawValue("k7"), ValueFactory.createRawValue("v7"),
95-
ValueFactory.createRawValue("k14"), ValueFactory.createRawValue("v14"),
96-
ValueFactory.createRawValue("k8"), ValueFactory.createRawValue("v8"),
97-
ValueFactory.createRawValue("k13"), ValueFactory.createRawValue("v13"),
98-
ValueFactory.createRawValue("k9"), ValueFactory.createRawValue("v9"),
99-
ValueFactory.createRawValue("k12"), ValueFactory.createRawValue("v12"),
100-
ValueFactory.createRawValue("k0"), ValueFactory.createNilValue(),
101-
ValueFactory.createRawValue("k1"), ValueFactory.createRawValue("v1"),
102-
ValueFactory.createRawValue("k2"), ValueFactory.createRawValue("v2"),
103-
ValueFactory.createRawValue("k18"), ValueFactory.createRawValue("v18"),
104-
ValueFactory.createRawValue("k19"), ValueFactory.createRawValue("v19"),
105-
ValueFactory.createRawValue("k16"), ValueFactory.createRawValue("v16"),
106-
ValueFactory.createRawValue("k17"), ValueFactory.createRawValue("v17"),
107-
});
105+
ValueFactory.createRawValue("k3"),
106+
ValueFactory.createRawValue("v3"),
107+
ValueFactory.createRawValue("k11"),
108+
ValueFactory.createRawValue("v11"),
109+
ValueFactory.createRawValue("k4"),
110+
ValueFactory.createRawValue("v4"),
111+
ValueFactory.createRawValue("k10"),
112+
ValueFactory.createRawValue("v10"),
113+
ValueFactory.createRawValue("k5"),
114+
ValueFactory.createRawValue("v5"),
115+
ValueFactory.createRawValue("k6"),
116+
ValueFactory.createRawValue("v6"),
117+
ValueFactory.createRawValue("k15"),
118+
ValueFactory.createRawValue("v15"),
119+
ValueFactory.createRawValue("k7"),
120+
ValueFactory.createRawValue("v7"),
121+
ValueFactory.createRawValue("k14"),
122+
ValueFactory.createRawValue("v14"),
123+
ValueFactory.createRawValue("k8"),
124+
ValueFactory.createRawValue("v8"),
125+
ValueFactory.createRawValue("k13"),
126+
ValueFactory.createRawValue("v13"),
127+
ValueFactory.createRawValue("k9"),
128+
ValueFactory.createRawValue("v9"),
129+
ValueFactory.createRawValue("k12"),
130+
ValueFactory.createRawValue("v12"),
131+
ValueFactory.createRawValue("k0"),
132+
ValueFactory.createNilValue(),
133+
ValueFactory.createRawValue("k1"),
134+
ValueFactory.createRawValue("v1"),
135+
ValueFactory.createRawValue("k2"),
136+
ValueFactory.createRawValue("v2"),
137+
ValueFactory.createRawValue("k18"),
138+
ValueFactory.createRawValue("v18"),
139+
ValueFactory.createRawValue("k19"),
140+
ValueFactory.createRawValue("v19"),
141+
ValueFactory.createRawValue("k16"),
142+
ValueFactory.createRawValue("v16"),
143+
ValueFactory.createRawValue("k17"),
144+
ValueFactory.createRawValue("v17"), });
108145
testEquals(v1, v2);
109146
}
110147

111148
@Override
112149
public void testByte(byte v) throws Exception {
113-
testLong((long)v);
150+
testLong((long) v);
114151
}
115152

116153
@Override
117154
public void testShort(short v) throws Exception {
118-
testLong((long)v);
155+
testLong((long) v);
119156
}
120157

121158
@Override
122159
public void testInteger(int v) throws Exception {
123-
testLong((long)v);
160+
testLong((long) v);
124161
}
125162

126163
@Override
@@ -130,7 +167,7 @@ public void testLong(long v) throws Exception {
130167

131168
@Override
132169
public void testBigInteger(BigInteger v) throws Exception {
133-
if(compatibleWithByte(v)) {
170+
if (compatibleWithByte(v)) {
134171
Value vt = ValueFactory.createIntegerValue(v);
135172
Value vByte = ValueFactory.createIntegerValue(v.byteValue());
136173
Value vShort = ValueFactory.createIntegerValue(v.shortValue());
@@ -143,7 +180,7 @@ public void testBigInteger(BigInteger v) throws Exception {
143180
testEquals(vt, vLong);
144181
testEquals(vt, vBigInteger);
145182
}
146-
if(compatibleWithShort(v)) {
183+
if (compatibleWithShort(v)) {
147184
Value vt = ValueFactory.createIntegerValue(v);
148185
Value vShort = ValueFactory.createIntegerValue(v.shortValue());
149186
Value vInt = ValueFactory.createIntegerValue(v.intValue());
@@ -154,7 +191,7 @@ public void testBigInteger(BigInteger v) throws Exception {
154191
testEquals(vt, vLong);
155192
testEquals(vt, vBigInteger);
156193
}
157-
if(compatibleWithInt(v)) {
194+
if (compatibleWithInt(v)) {
158195
Value vt = ValueFactory.createIntegerValue(v);
159196
Value vInt = ValueFactory.createIntegerValue(v.intValue());
160197
Value vLong = ValueFactory.createIntegerValue(v.longValue());
@@ -163,7 +200,7 @@ public void testBigInteger(BigInteger v) throws Exception {
163200
testEquals(vt, vLong);
164201
testEquals(vt, vBigInteger);
165202
}
166-
if(compatibleWithLong(v)) {
203+
if (compatibleWithLong(v)) {
167204
Value vt = ValueFactory.createIntegerValue(v);
168205
Value vLong = ValueFactory.createIntegerValue(v.longValue());
169206
Value vBigInteger = ValueFactory.createIntegerValue(v);
@@ -188,52 +225,60 @@ public void testNull() {
188225

189226
@SuppressWarnings("unused")
190227
private boolean compatibleWithByte(long v) {
191-
return (long)Byte.MIN_VALUE <= v && v <= (long)Byte.MAX_VALUE;
228+
return (long) Byte.MIN_VALUE <= v && v <= (long) Byte.MAX_VALUE;
192229
}
193230

194231
@SuppressWarnings("unused")
195232
private boolean compatibleWithShort(long v) {
196-
return (long)Short.MIN_VALUE <= v && v <= (long)Short.MAX_VALUE;
233+
return (long) Short.MIN_VALUE <= v && v <= (long) Short.MAX_VALUE;
197234
}
198235

199236
@SuppressWarnings("unused")
200237
private boolean compatibleWithInt(long v) {
201-
return (long)Integer.MIN_VALUE <= v && v <= (long)Integer.MAX_VALUE;
238+
return (long) Integer.MIN_VALUE <= v && v <= (long) Integer.MAX_VALUE;
202239
}
203240

204-
private static BigInteger BYTE_MAX = BigInteger.valueOf((long)Byte.MAX_VALUE);
205-
private static BigInteger SHORT_MAX = BigInteger.valueOf((long)Short.MAX_VALUE);
206-
private static BigInteger INT_MAX = BigInteger.valueOf((long)Integer.MAX_VALUE);
207-
private static BigInteger LONG_MAX = BigInteger.valueOf((long)Long.MAX_VALUE);
241+
private static BigInteger BYTE_MAX = BigInteger
242+
.valueOf((long) Byte.MAX_VALUE);
243+
private static BigInteger SHORT_MAX = BigInteger
244+
.valueOf((long) Short.MAX_VALUE);
245+
private static BigInteger INT_MAX = BigInteger
246+
.valueOf((long) Integer.MAX_VALUE);
247+
private static BigInteger LONG_MAX = BigInteger
248+
.valueOf((long) Long.MAX_VALUE);
208249

209-
private static BigInteger BYTE_MIN = BigInteger.valueOf((long)Byte.MIN_VALUE);
210-
private static BigInteger SHORT_MIN = BigInteger.valueOf((long)Short.MIN_VALUE);
211-
private static BigInteger INT_MIN = BigInteger.valueOf((long)Integer.MIN_VALUE);
212-
private static BigInteger LONG_MIN = BigInteger.valueOf((long)Long.MIN_VALUE);
250+
private static BigInteger BYTE_MIN = BigInteger
251+
.valueOf((long) Byte.MIN_VALUE);
252+
private static BigInteger SHORT_MIN = BigInteger
253+
.valueOf((long) Short.MIN_VALUE);
254+
private static BigInteger INT_MIN = BigInteger
255+
.valueOf((long) Integer.MIN_VALUE);
256+
private static BigInteger LONG_MIN = BigInteger
257+
.valueOf((long) Long.MIN_VALUE);
213258

214259
protected boolean compatibleWithByte(BigInteger v) {
215-
if(v.compareTo(BYTE_MAX) > 0 || v.compareTo(BYTE_MIN) < 0) {
260+
if (v.compareTo(BYTE_MAX) > 0 || v.compareTo(BYTE_MIN) < 0) {
216261
return false;
217262
}
218263
return true;
219264
}
220265

221266
protected boolean compatibleWithShort(BigInteger v) {
222-
if(v.compareTo(SHORT_MAX) > 0 || v.compareTo(SHORT_MIN) < 0) {
267+
if (v.compareTo(SHORT_MAX) > 0 || v.compareTo(SHORT_MIN) < 0) {
223268
return false;
224269
}
225270
return true;
226271
}
227272

228273
protected boolean compatibleWithInt(BigInteger v) {
229-
if(v.compareTo(INT_MAX) > 0 || v.compareTo(INT_MIN) < 0) {
274+
if (v.compareTo(INT_MAX) > 0 || v.compareTo(INT_MIN) < 0) {
230275
return false;
231276
}
232277
return true;
233278
}
234279

235280
protected boolean compatibleWithLong(BigInteger v) {
236-
if(v.compareTo(LONG_MAX) > 0 || v.compareTo(LONG_MIN) < 0) {
281+
if (v.compareTo(LONG_MAX) > 0 || v.compareTo(LONG_MIN) < 0) {
237282
return false;
238283
}
239284
return true;
@@ -253,4 +298,3 @@ protected Value getValue() {
253298
}));
254299
}
255300
}
256-

src/test/java/org/msgpack/type/TestHashCode.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22

33
import static org.junit.Assert.assertEquals;
44

5-
65
public class TestHashCode extends TestEquals {
76
@Override
87
protected void testEquals(Value v1, Value v2) {
98
assertEquals(v1.hashCode(), v2.hashCode());
109
}
1110
}
12-

0 commit comments

Comments
 (0)