Skip to content

Commit

Permalink
Revise logic for expected oldest
Browse files Browse the repository at this point in the history
+ use multiline string literal
  • Loading branch information
mrotteveel committed Dec 22, 2024
1 parent e1fcc1a commit 51bd70e
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions src/test/org/firebirdsql/management/FBStatisticsManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ class FBStatisticsManagerTest {
private FBStatisticsManager statManager;
private OutputStream loggingStream;

private static final String DEFAULT_TABLE = ""
+ "CREATE TABLE TEST ("
+ " TESTVAL INTEGER NOT NULL"
+ ")";
private static final String DEFAULT_TABLE = """
CREATE TABLE TEST (
TESTVAL INTEGER NOT NULL
)""";

@BeforeEach
void setUp() {
Expand Down Expand Up @@ -126,7 +126,7 @@ void testGetTableStatistics() throws SQLException {
void testGetDatabaseTransactionInfo_usingServiceConfig() throws SQLException {
FirebirdSupportInfo supportInfo = getDefaultSupportInfo();
int oldest = getExpectedOldest(supportInfo);
int expectedNextOffset = supportInfo.isVersionEqualOrAbove(3, 0) ? 1 : 2;
int expectedNextOffset = supportInfo.isVersionEqualOrAbove(3) ? 1 : 2;
createTestTable();

try (Connection conn = getConnectionViaDriverManager()) {
Expand All @@ -145,12 +145,12 @@ void testGetDatabaseTransactionInfo_usingServiceConfig() throws SQLException {
}

private int getExpectedOldest(FirebirdSupportInfo supportInfo) {
if (supportInfo.isVersionEqualOrAbove(4, 0, 2) && !isEmbeddedType().matches(GDS_TYPE)) {
return 2;
if (supportInfo.isVersionEqualOrAbove(4, 0, 2)) {
return isEmbeddedType().matches(GDS_TYPE) ? 1 : 2;
} else if (supportInfo.isVersionEqualOrAbove(4, 0)) {
return 1;
} else if (supportInfo.isVersionEqualOrAbove(3, 0, 10)) {
return 2;
return isEmbeddedType().matches(GDS_TYPE) ? 1 : 2;
} else if (supportInfo.isVersionEqualOrAbove(2, 5)) {
return 1;
} else {
Expand All @@ -169,14 +169,7 @@ void testGetDatabaseTransactionInfo_noDatabaseNameSpecified() {
void testGetDatabaseTransactionInfo_usingConnection() throws SQLException {
FirebirdSupportInfo supportInfo = getDefaultSupportInfo();
int oldest = getExpectedOldest(supportInfo);
int expectedNextOffset;
if (supportInfo.isVersionEqualOrAbove(3, 0)) {
expectedNextOffset = 1;
} else if (supportInfo.isVersionEqualOrAbove(2, 5)) {
expectedNextOffset = 2;
} else {
expectedNextOffset = 1;
}
int expectedNextOffset = supportInfo.isVersionEqualOrAbove(2, 5) && supportInfo.isVersionBelow(3) ? 2 : 1;
createTestTable();

try (Connection conn = getConnectionViaDriverManager()) {
Expand Down

0 comments on commit 51bd70e

Please sign in to comment.