Skip to content

Commit 51bd70e

Browse files
committed
Revise logic for expected oldest
+ use multiline string literal
1 parent e1fcc1a commit 51bd70e

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

src/test/org/firebirdsql/management/FBStatisticsManagerTest.java

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ class FBStatisticsManagerTest {
4747
private FBStatisticsManager statManager;
4848
private OutputStream loggingStream;
4949

50-
private static final String DEFAULT_TABLE = ""
51-
+ "CREATE TABLE TEST ("
52-
+ " TESTVAL INTEGER NOT NULL"
53-
+ ")";
50+
private static final String DEFAULT_TABLE = """
51+
CREATE TABLE TEST (
52+
TESTVAL INTEGER NOT NULL
53+
)""";
5454

5555
@BeforeEach
5656
void setUp() {
@@ -126,7 +126,7 @@ void testGetTableStatistics() throws SQLException {
126126
void testGetDatabaseTransactionInfo_usingServiceConfig() throws SQLException {
127127
FirebirdSupportInfo supportInfo = getDefaultSupportInfo();
128128
int oldest = getExpectedOldest(supportInfo);
129-
int expectedNextOffset = supportInfo.isVersionEqualOrAbove(3, 0) ? 1 : 2;
129+
int expectedNextOffset = supportInfo.isVersionEqualOrAbove(3) ? 1 : 2;
130130
createTestTable();
131131

132132
try (Connection conn = getConnectionViaDriverManager()) {
@@ -145,12 +145,12 @@ void testGetDatabaseTransactionInfo_usingServiceConfig() throws SQLException {
145145
}
146146

147147
private int getExpectedOldest(FirebirdSupportInfo supportInfo) {
148-
if (supportInfo.isVersionEqualOrAbove(4, 0, 2) && !isEmbeddedType().matches(GDS_TYPE)) {
149-
return 2;
148+
if (supportInfo.isVersionEqualOrAbove(4, 0, 2)) {
149+
return isEmbeddedType().matches(GDS_TYPE) ? 1 : 2;
150150
} else if (supportInfo.isVersionEqualOrAbove(4, 0)) {
151151
return 1;
152152
} else if (supportInfo.isVersionEqualOrAbove(3, 0, 10)) {
153-
return 2;
153+
return isEmbeddedType().matches(GDS_TYPE) ? 1 : 2;
154154
} else if (supportInfo.isVersionEqualOrAbove(2, 5)) {
155155
return 1;
156156
} else {
@@ -169,14 +169,7 @@ void testGetDatabaseTransactionInfo_noDatabaseNameSpecified() {
169169
void testGetDatabaseTransactionInfo_usingConnection() throws SQLException {
170170
FirebirdSupportInfo supportInfo = getDefaultSupportInfo();
171171
int oldest = getExpectedOldest(supportInfo);
172-
int expectedNextOffset;
173-
if (supportInfo.isVersionEqualOrAbove(3, 0)) {
174-
expectedNextOffset = 1;
175-
} else if (supportInfo.isVersionEqualOrAbove(2, 5)) {
176-
expectedNextOffset = 2;
177-
} else {
178-
expectedNextOffset = 1;
179-
}
172+
int expectedNextOffset = supportInfo.isVersionEqualOrAbove(2, 5) && supportInfo.isVersionBelow(3) ? 2 : 1;
180173
createTestTable();
181174

182175
try (Connection conn = getConnectionViaDriverManager()) {

0 commit comments

Comments
 (0)