Skip to content

Commit de6f247

Browse files
committed
remove some warnings in tests
1 parent b4df6eb commit de6f247

32 files changed

+239
-239
lines changed

net.lecousin.core/.checkstyle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
3+
<fileset-config file-format-version="1.2.0" simple-config="false" sync-formatter="false">
44
<local-check-config name="parent-pom" location="/net.lecousin.parent-pom/src/resources/checkstyle.xml" type="project" description="">
55
<additional-data name="protect-config-file" value="false"/>
66
</local-check-config>
77
<fileset name="all" enabled="true" check-config-name="parent-pom" local="true">
8-
<file-match-pattern match-pattern="." include-pattern="true"/>
8+
<file-match-pattern match-pattern="src/main/java/." include-pattern="true"/>
99
</fileset>
1010
</fileset-config>

net.lecousin.core/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
33
<modelVersion>4.0.0</modelVersion>
4-
<groupId>net.lecousin</groupId>
54
<artifactId>core</artifactId>
65
<version>0.9.10</version>
76

net.lecousin.core/src/main/java/net/lecousin/framework/io/serialization/AbstractSerializationSpecWriter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ protected List<SerializationRule> addRulesForAttribute(Attribute a, List<Seriali
7676

7777
protected abstract ISynchronizationPoint<? extends Exception> specifyAnyValue(SerializationContext context);
7878

79+
/** Can be used when already initialized. */
7980
public ISynchronizationPoint<? extends Exception> specifyValue(
8081
SerializationContext context, TypeDefinition typeDef, List<SerializationRule> rules
8182
) {

net.lecousin.core/src/test/java/net/lecousin/framework/core/test/io/TestIO.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ protected long getFileSize() {
111111

112112
protected abstract IO getIOForCommonTests() throws Exception;
113113

114+
@SuppressWarnings("resource")
114115
@Test(timeout=120000)
115116
public void testBasicCommonFunctions() throws Exception {
116117
IO io = getIOForCommonTests();

net.lecousin.core/src/test/java/net/lecousin/framework/core/test/io/TestReadWrite.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ public <T extends IO.Readable.Seekable & IO.Writable.Seekable> void testWriteThe
6868
io.close();
6969
}
7070

71-
@SuppressWarnings("resource")
7271
@Test(timeout=120000)
7372
public <T extends IO.Readable.Seekable & IO.Writable.Seekable> void testRandomWriteAndReadAsync() throws Exception {
7473
Assume.assumeTrue(nbBuf > 0);
@@ -336,7 +335,6 @@ void dichotomicWriteSync(T io, int bufStart, int bufEnd, SeekType seekType) thro
336335
io.writeSync(ByteBuffer.wrap(testBuf, 0, testBuf.length / 2));
337336
}
338337

339-
@SuppressWarnings("resource")
340338
@Test(timeout=120000)
341339
public <T extends IO.Readable.Seekable & IO.Writable.Seekable> void testSeekAsyncWriteOddEvenThenReadReverse() throws Exception {
342340
Assume.assumeTrue(nbBuf > 0);

net.lecousin.core/src/test/java/net/lecousin/framework/core/test/io/TestReadWriteResizable.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ void testResizeSync() throws Exception {
107107
io.close();
108108
}
109109

110-
@SuppressWarnings("resource")
111110
@Test(timeout=120000)
112111
public <T extends IO.Readable.Seekable & IO.Writable.Seekable & IO.KnownSize & IO.Resizable>
113112
void testResizeAsync() throws Exception {

net.lecousin.core/src/test/java/net/lecousin/framework/core/test/io/TestReadable.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ public void testReadableBufferByBufferFullySyncBigBuffer() throws Exception {
115115
io.close();
116116
}
117117

118-
@SuppressWarnings("resource")
119118
@Test(timeout=120000)
120119
public void testReadableBufferByBufferFullyAsync() throws Exception {
121120
IO.Readable io = createReadableFromFile(openFile(), getFileSize());
@@ -197,7 +196,6 @@ public void run() {
197196
io.close();
198197
}
199198

200-
@SuppressWarnings("resource")
201199
@Test(timeout=120000)
202200
public void testReadableBufferByBufferFullyAsyncBigBuffer() throws Exception {
203201
IO.Readable io = createReadableFromFile(openFile(), getFileSize());
@@ -258,7 +256,6 @@ public void run() {
258256
io.close();
259257
}
260258

261-
@SuppressWarnings("resource")
262259
@Test(timeout=120000)
263260
public void testReadableBufferByBufferAsync() throws Exception {
264261
IO.Readable io = createReadableFromFile(openFile(), getFileSize());
@@ -353,7 +350,6 @@ public void testReadableSkipSync() throws Exception {
353350
io.close();
354351
}
355352

356-
@SuppressWarnings("resource")
357353
@Test(timeout=120000)
358354
public void testReadableSkipAsync() throws Exception {
359355
Assume.assumeTrue(nbBuf > 0);

net.lecousin.core/src/test/java/net/lecousin/framework/core/test/io/TestReadableSeekable.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ public void testSeekableByteByByteSync() throws Exception {
7676
io.close();
7777
}
7878

79-
@SuppressWarnings({ "resource" })
8079
@Test(timeout=300000)
8180
public void testSeekableByteByByteAsync() throws Exception {
8281
IO.Readable.Seekable io = createReadableSeekableFromFile(openFile(), getFileSize());
@@ -186,7 +185,6 @@ public void testSeekableBufferByBufferFullySync() throws Exception {
186185
io.close();
187186
}
188187

189-
@SuppressWarnings("resource")
190188
@Test(timeout=120000)
191189
public void testSeekableBufferByBufferFullyAsync() throws Exception {
192190
IO.Readable.Seekable io = createReadableSeekableFromFile(openFile(), getFileSize());
@@ -349,7 +347,6 @@ private void testSeekSync(IO.Readable.Seekable io, SeekType type, long move, lon
349347
}
350348
}
351349

352-
@SuppressWarnings("resource")
353350
@Test(timeout=120000)
354351
public void testSeekAsync() throws Exception {
355352
long size = getFileSize();
@@ -506,7 +503,6 @@ public void testSeekSyncWrong() throws Exception {
506503
io.close();
507504
}
508505

509-
@SuppressWarnings("resource")
510506
@Test(timeout=120000)
511507
public void testSeekAsyncWrong() throws Exception {
512508
long size = getFileSize();

net.lecousin.core/src/test/java/net/lecousin/framework/core/test/io/TestWritableToFile.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ public void testWriteBufferByBufferSync() throws Exception {
7777
checkFile(file, testBuf, nbBuf);
7878
}
7979

80-
@SuppressWarnings("resource")
8180
@Test(timeout=120000)
8281
public void testWriteBufferByBufferAsync() throws Exception {
8382
Assume.assumeTrue(nbBuf > 0);

net.lecousin.core/src/test/java/net/lecousin/framework/core/test/serialization/TestSerialization.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ public void testMap() throws Exception {
437437
map.put(Integer.valueOf(2), "World");
438438
map.put(Integer.valueOf(3), "!");
439439
map.put(Integer.valueOf(4), null);
440+
@SuppressWarnings("resource")
440441
MemoryIO io = serializeInMemory(map, new TypeDefinition(HashMap.class, new TypeDefinition(Integer.class), new TypeDefinition(String.class)));
441442
print(io, map);
442443
Map<Integer,String> map2 = deserialize(io, new TypeDefinition(HashMap.class, new TypeDefinition(Integer.class), new TypeDefinition(String.class)));
@@ -791,6 +792,7 @@ public void testMergeAttributesOfListElements2() throws Exception {
791792
m = new Merged();
792793
m.aString = "World";
793794
t.list.add(new Pair<>("le monde", m));
795+
@SuppressWarnings("resource")
794796
MemoryIO io = serializeInMemory(t, new TypeDefinition(ToMerge3.class));
795797
print(io, t);
796798
deserialize(io, new TypeDefinition(Merged3.class));
@@ -978,6 +980,7 @@ protected <T> T deserialize(IO.Readable io, TypeDefinition type) throws Exceptio
978980
protected void testSpec(Class<?> type, MemoryIO serialization) throws Exception {
979981
SerializationSpecWriter sw = createSpecWriter();
980982
if (sw == null) return;
983+
@SuppressWarnings("resource")
981984
MemoryIO io = new MemoryIO(1024, "test");
982985
sw.writeSpecification(type, io, new ArrayList<>(0)).blockThrow(0);
983986
printSpec(io, type);
@@ -1096,6 +1099,7 @@ protected void printSpec(IO.Readable.Seekable io, Class<?> type) throws Exceptio
10961099
System.out.println("Serialization specification for " + type.getName() + "\r\n" + content);
10971100
}
10981101

1102+
@SuppressWarnings("unused")
10991103
protected void checkSpec(IO.Readable.Seekable spec, Class<?> type, IO.Readable.Seekable serialization) throws Exception {
11001104
}
11011105
}

0 commit comments

Comments
 (0)