Skip to content

Commit

Permalink
[NETBEANS-6118] - Fix test failures in 'j2ee.core' (apache#3226)
Browse files Browse the repository at this point in the history
- Fix test failures
- Add missing tests
- Remove redundant if statement
  • Loading branch information
pepness authored Oct 9, 2021
1 parent f2ca686 commit 7c532ee
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,8 @@ private static boolean isVersionEqualOrHigher(@NonNull Profile profileToCompare,
if (profileToCompareVersion.equals(comparingProfileVersion)) {
return compareWebAndFull(profileToCompare, comparingVersion);
} else {
if (comparisonResult > 0) {
// profileToCompare has lower version than comparingVersion
return false;
} else {
return true;
}
// profileToCompare has lower version than comparingVersion
return comparisonResult <= 0;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ public void testFromPropertiesString() {
assertEquals(Profile.JAVA_EE_6_FULL, Profile.fromPropertiesString("EE_6_FULL"));
assertEquals(Profile.JAVA_EE_6_WEB, Profile.fromPropertiesString("1.6-web"));
assertEquals(Profile.JAVA_EE_6_WEB, Profile.fromPropertiesString("EE_6_WEB"));
assertEquals(Profile.JAVA_EE_7_FULL, Profile.fromPropertiesString("1.7"));
assertEquals(Profile.JAVA_EE_7_FULL, Profile.fromPropertiesString("EE_7_FULL"));
assertEquals(Profile.JAVA_EE_7_WEB, Profile.fromPropertiesString("1.7-web"));
assertEquals(Profile.JAVA_EE_7_WEB, Profile.fromPropertiesString("EE_7_WEB"));
assertEquals(Profile.JAVA_EE_8_FULL, Profile.fromPropertiesString("1.8"));
assertEquals(Profile.JAVA_EE_8_FULL, Profile.fromPropertiesString("EE_8_FULL"));
assertEquals(Profile.JAVA_EE_8_WEB, Profile.fromPropertiesString("1.8-web"));
assertEquals(Profile.JAVA_EE_8_WEB, Profile.fromPropertiesString("EE_8_WEB"));
assertEquals(Profile.JAKARTA_EE_8_FULL, Profile.fromPropertiesString("8.0"));
assertEquals(Profile.JAKARTA_EE_8_FULL, Profile.fromPropertiesString("JAKARTA_EE_8_FULL"));
assertEquals(Profile.JAKARTA_EE_8_WEB, Profile.fromPropertiesString("8.0-web"));
assertEquals(Profile.JAKARTA_EE_8_WEB, Profile.fromPropertiesString("JAKARTA_EE_8_WEB"));
assertEquals(Profile.JAKARTA_EE_9_FULL, Profile.fromPropertiesString("9.0"));
assertEquals(Profile.JAKARTA_EE_9_FULL, Profile.fromPropertiesString("JAKARTA_EE_9_FULL"));
assertEquals(Profile.JAKARTA_EE_9_WEB, Profile.fromPropertiesString("9.0-web"));
assertEquals(Profile.JAKARTA_EE_9_WEB, Profile.fromPropertiesString("JAKARTA_EE_9_WEB"));
assertNull(Profile.fromPropertiesString("something"));
}

Expand Down Expand Up @@ -97,8 +113,8 @@ public void testIsHigherJavaEEVersionJakartaEE8full() {
assertFalse(Profile.JAVA_EE_6_FULL.isAtLeast(Profile.JAKARTA_EE_8_WEB));
assertFalse(Profile.JAVA_EE_7_WEB.isAtLeast(Profile.JAKARTA_EE_8_WEB));
assertFalse(Profile.JAVA_EE_7_FULL.isAtLeast(Profile.JAKARTA_EE_8_WEB));
assertTrue(Profile.JAVA_EE_8_WEB.isAtLeast(Profile.JAKARTA_EE_8_WEB));
assertTrue(Profile.JAVA_EE_8_FULL.isAtLeast(Profile.JAKARTA_EE_8_WEB));
assertFalse(Profile.JAVA_EE_8_WEB.isAtLeast(Profile.JAKARTA_EE_8_WEB));
assertFalse(Profile.JAVA_EE_8_FULL.isAtLeast(Profile.JAKARTA_EE_8_WEB));
assertTrue(Profile.JAKARTA_EE_8_WEB.isAtLeast(Profile.JAKARTA_EE_8_WEB));
assertTrue(Profile.JAKARTA_EE_8_FULL.isAtLeast(Profile.JAKARTA_EE_8_WEB));
}
Expand All @@ -112,10 +128,10 @@ public void testIsHigherJavaEEVersionJakartaEE9full() {
assertFalse(Profile.JAVA_EE_6_FULL.isAtLeast(Profile.JAKARTA_EE_9_WEB));
assertFalse(Profile.JAVA_EE_7_WEB.isAtLeast(Profile.JAKARTA_EE_9_WEB));
assertFalse(Profile.JAVA_EE_7_FULL.isAtLeast(Profile.JAKARTA_EE_9_WEB));
assertTrue(Profile.JAVA_EE_8_WEB.isAtLeast(Profile.JAKARTA_EE_9_WEB));
assertTrue(Profile.JAVA_EE_8_FULL.isAtLeast(Profile.JAKARTA_EE_9_WEB));
assertTrue(Profile.JAKARTA_EE_8_WEB.isAtLeast(Profile.JAKARTA_EE_9_WEB));
assertTrue(Profile.JAKARTA_EE_8_FULL.isAtLeast(Profile.JAKARTA_EE_9_WEB));
assertFalse(Profile.JAVA_EE_8_WEB.isAtLeast(Profile.JAKARTA_EE_9_WEB));
assertFalse(Profile.JAVA_EE_8_FULL.isAtLeast(Profile.JAKARTA_EE_9_WEB));
assertFalse(Profile.JAKARTA_EE_8_WEB.isAtLeast(Profile.JAKARTA_EE_9_WEB));
assertFalse(Profile.JAKARTA_EE_8_FULL.isAtLeast(Profile.JAKARTA_EE_9_WEB));
assertTrue(Profile.JAKARTA_EE_9_WEB.isAtLeast(Profile.JAKARTA_EE_9_WEB));
assertTrue(Profile.JAKARTA_EE_9_FULL.isAtLeast(Profile.JAKARTA_EE_9_WEB));
}
Expand Down

0 comments on commit 7c532ee

Please sign in to comment.