@Test public void testToAndFromPb() { compareInstanceInfo(INSTANCE_INFO, InstanceInfo.fromPb(INSTANCE_INFO.toPb())); InstanceInfo instance = InstanceInfo.of(INSTANCE_ID, MACHINE_TYPE, ATTACHED_DISK, NETWORK_INTERFACE); compareInstanceInfo(instance, InstanceInfo.fromPb(instance.toPb())); }
@Test public void testToBuilder() { compareInstanceInfo(INSTANCE_INFO, INSTANCE_INFO.toBuilder().build()); InstanceInfo instance = INSTANCE_INFO.toBuilder().setDescription("newDescription").build(); assertEquals("newDescription", instance.getDescription()); instance = instance.toBuilder().setDescription(DESCRIPTION).build(); compareInstanceInfo(INSTANCE_INFO, instance); }
@Test public void testSetProjectId() { InstanceInfo instance = InstanceInfo.of( InstanceId.of("zone", "instance"), MachineTypeId.of("zone", "type"), AttachedDisk.of(AttachedDisk.PersistentDiskConfiguration.of(DiskId.of("zone", "disk"))), NetworkInterface.of(NetworkId.of("project", "network"))); InstanceInfo instanceWithProject = InstanceInfo.of(INSTANCE_ID, MACHINE_TYPE, ATTACHED_DISK, NETWORK_INTERFACE); compareInstanceInfo(instanceWithProject, instance.setProjectId("project")); }
.setCpuPlatform(CPU_PLATFORM) .build(); compareInstanceInfo(INSTANCE_INFO, instanceInfo);