Skip to content

Commit

Permalink
Adjust test to compare to latest supported ASM version, not Byte Budd…
Browse files Browse the repository at this point in the history
…y constant.
  • Loading branch information
raphw committed Jun 28, 2021
1 parent 28b94d0 commit f0acdfc
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ public void testClassFile() throws Exception {

@Test
public void testLatestVersion() throws Exception {
Pattern pattern = Pattern.compile("JAVA_V[0-9]+");
ClassFileVersion latest = null;
for (Field field : ClassFileVersion.class.getFields()) {
double version = 0d;
int value = 0;
Pattern pattern = Pattern.compile("V[0-9]+(_[0-9]+)?");
for (Field field : Opcodes.class.getFields()) {
if (pattern.matcher(field.getName()).matches()) {
ClassFileVersion classFileVersion = (ClassFileVersion) field.get(null);
if (latest == null || classFileVersion.isGreaterThan(latest)) {
latest = classFileVersion;
if (version < Double.parseDouble(field.getName().substring(1).replace('_', '.'))) {
value = field.getInt(null);
}
}
}
assertThat(ClassFileVersion.latest(), is(latest));
assertThat(ClassFileVersion.latest().getMajorVersion(), is((short) value));
}

@Test(expected = IllegalArgumentException.class)
Expand Down

0 comments on commit f0acdfc

Please sign in to comment.