Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions JavaReleases/src/test/java/pl/mperor/lab/java/Java0.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ public void testProperties() throws IOException {
Assertions.assertNull(properties.get("timeout")); // Hashtable.get ignores defaults

// Properties extends Hashtable<Object, Object> - a design flaw, as non-String values can be put but not read back
// Since Java 9 the inherited Hashtable storage is unused - entries live in an internal ConcurrentHashMap (lock-free reads)
Assertions.assertInstanceOf(Hashtable.class, properties);
properties.put("port", 8080);
Assertions.assertNull(properties.getProperty("port"));
}
Expand Down
44 changes: 23 additions & 21 deletions JavaReleases/src/test/java/pl/mperor/lab/java/Java1.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,35 @@

/**
* Java 1.1 (February 1997)
*
* <p>
* - LANGUAGE FEATURES:
* - Inner classes (member, local & anonymous)
* - Instance initializer blocks
* - Class literals (`String.class`)
* - Blank finals
*
* - Inner classes (member, local & anonymous)
* - Instance initializer blocks
* - Class literals (`String.class`)
* - Blank finals
* <p>
* - LIBRARIES & APIs:
* - JavaBeans
* - JDBC (Java Database Connectivity)
* - RMI (Remote Method Invocation)
* - Reflection API
* - Object Serialization
* - Character Streams (`Reader` / `Writer`) & Unicode 2.0
* - Internationalization (`java.text`, `Locale`, `ResourceBundle`)
* - Arbitrary-Precision Arithmetic (`java.math`)
* - AWT Event Delegation Model
* - JNI (Java Native Interface)
*
* - JavaBeans
* - JDBC (Java Database Connectivity)
* - RMI (Remote Method Invocation)
* - Reflection API
* - Object Serialization
* - Character Streams (`Reader` / `Writer`) & Unicode 2.0
* - Internationalization (`java.text`, `Locale`, `ResourceBundle`)
* - Arbitrary-Precision Arithmetic (`java.math`)
* - AWT Event Delegation Model
* - JNI (Java Native Interface)
* <p>
* - TOOLS:
* - JAR files (`jar`)
* - Signed JARs (`javakey`)
* - JAR files (`jar`)
* - Signed JARs (`javakey`)
*/
public class Java1 {

@Test
public void testInnerAndNestedStaticClasses() {
// Java 1.1 added nested classes - a static nested class needs no outer instance,
// while an inner class is bound to one and can access its members via OuterClass.this
StaticNestedClass nested = new StaticNestedClass();
Assertions.assertNotNull(nested);

Expand Down Expand Up @@ -151,7 +153,7 @@ public String getMessage() throws RemoteException {
@Test
public void testJavaDatabaseConnectivityAkaJDBC() throws SQLException, ClassNotFoundException {
String createTableUsersSqlCommand = "CREATE TABLE IF NOT EXISTS users (id INT AUTO_INCREMENT PRIMARY KEY, name TEXT)";
String insertUserSqlCommand = "INSERT INTO users (name) VALUES ('Mark Pi')";
String insertUserSqlCommand = "INSERT INTO users (name) VALUES ('John Doe')";
String queryAllUsersSqlCommand = "SELECT * FROM users";

// Load the H2 JDBC driver: its static initializer registers it in DriverManager.
Expand All @@ -167,7 +169,7 @@ public void testJavaDatabaseConnectivityAkaJDBC() throws SQLException, ClassNotF
try (ResultSet resultSet = statement.executeQuery(queryAllUsersSqlCommand)) {
Assertions.assertTrue(resultSet.next());
Assertions.assertEquals(1, resultSet.getInt("id"));
Assertions.assertEquals("Mark Pi", resultSet.getString("name"));
Assertions.assertEquals("John Doe", resultSet.getString("name"));
}
}
}
Expand Down
Loading