Skip to content

Commit bd019ca

Browse files
committed
Split testIndex into separate ListTag/CompoundTag tests
1 parent 870c3b8 commit bd019ca

1 file changed

Lines changed: 22 additions & 23 deletions

File tree

‎src/test/java/org/glavo/nbt/tag/TagTests.java‎

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -161,37 +161,36 @@ private static void verifyIndex(ParentTag<?> list) {
161161
}
162162

163163
@Test
164-
public void testIndex() {
165-
{
166-
var listTag = new ListTag<>("Parent", ByteTag.class);
164+
public void testSubTagIndexOfListTag() {
165+
var listTag = new ListTag<>("Parent", ByteTag.class);
167166

168-
for (int i = 0; i < 100; i++) {
169-
listTag.add(new ByteTag("", (byte) i));
170-
}
167+
for (int i = 0; i < 100; i++) {
168+
listTag.add(new ByteTag("", (byte) i));
169+
}
171170

172-
verifyIndex(listTag);
171+
verifyIndex(listTag);
173172

174-
var sub10 = listTag.get(10);
175-
listTag.remove(sub10);
173+
var sub10 = listTag.get(10);
174+
listTag.remove(sub10);
176175

177-
verifyIndex(listTag);
178-
assertEquals(-1, sub10.getIndex());
179-
}
176+
verifyIndex(listTag);
177+
assertEquals(-1, sub10.getIndex());
178+
}
180179

181-
{
182-
var compoundTag = new CompoundTag<>("Parent");
180+
@Test
181+
public void testSubTagIndexOfCompoundTag() {
182+
var compoundTag = new CompoundTag<>("Parent");
183183

184-
for (int i = 0; i < 100; i++) {
185-
compoundTag.add(new ByteTag("Sub" + i, (byte) i));
186-
}
184+
for (int i = 0; i < 100; i++) {
185+
compoundTag.add(new ByteTag("Sub" + i, (byte) i));
186+
}
187187

188-
verifyIndex(compoundTag);
188+
verifyIndex(compoundTag);
189189

190-
var sub10 = compoundTag.get(10);
191-
compoundTag.remove(sub10);
190+
var sub10 = compoundTag.get(10);
191+
compoundTag.remove(sub10);
192192

193-
verifyIndex(compoundTag);
194-
assertEquals(-1, sub10.getIndex());
195-
}
193+
verifyIndex(compoundTag);
194+
assertEquals(-1, sub10.getIndex());
196195
}
197196
}

0 commit comments

Comments
 (0)