Skip to content

Instantly share code, notes, and snippets.

version: 2.1
jobs:
say-hello:
docker:
- image: cimg/base:stable
steps:
- checkout
- run:
name: "Say hello from external config.yml"
We couldn’t find that file to show.
@Test
void testToList() {
List<String> list = Stream.of("a", "b").map(String::toUpperCase).toList();
assertEquals("[A, B]", list.toString());
}
record FullName(String firstName, String lastName) {}
@Test
void testRecords() {
var fullName = new FullName("Mitsuyuki", "Shiiba");
assertEquals("Mitsuyuki", fullName.firstName());
assertEquals("Shiiba", fullName.lastName());
assertEquals("FullName[firstName=Mitsuyuki, lastName=Shiiba]", fullName.toString());
}
@Test
void testInstanceof1() {
Object o = "";
if (o instanceof String s) {
assertTrue(s.isEmpty());
return;
}
fail("ここには来ないよ");
}
@Test
void testTextBlocks1() {
String html1 = "<html>\n" +
" <body>\n" +
" <p>Hello, world</p>\n" +
" </body>\n" +
"</html>\n";
String html2 = """
<html>
int switchSample1(DayOfWeek dayOfWeek) {
return switch (dayOfWeek) {
case MONDAY, TUESDAY:
yield 1;
case WEDNESDAY, THURSDAY, FRIDAY:
yield 2;
case SATURDAY:
yield 3;
case SUNDAY:
yield 4;
@Test
void testHelpfulNullPointerExceptions() {
NullPointerException npe = assertThrows(NullPointerException.class, () -> {
Object o = null;
o.toString();
});
assertEquals("Cannot invoke \"Object.toString()\" because \"o\" is null", npe.getMessage());
}
apiVersion: networking.gke.io/v1beta1
kind: ManagedCertificate
metadata:
name: helloweb-certificate
spec:
domains:
- gke.shiiba.dev
admin:
access_log_path: /tmp/admin_access.log
address:
socket_address:
protocol: TCP
address: 127.0.0.1
port_value: 9901
static_resources:
listeners:
- name: listener_0