@Test public void readInvalidClientIdentifierAsMember() throws Exception { thrown.expectError(ErrorCodes.X_INVALID_CLIENT_IDENTIFIER); ClientId id = parseClientId( fileToType("invalid-clientid-member.xml", MEMBER, XRoadClientIdentifierType.class)); }
static ClientId parseClientId(XRoadIdentifierType v) { if (XRoadObjectType.SUBSYSTEM.equals(v.getObjectType()) && v.getSubsystemCode() == null) { throw new CodedException(X_INVALID_CLIENT_IDENTIFIER, "Missing required subsystem code"); } if (XRoadObjectType.MEMBER.equals(v.getObjectType()) && v.getSubsystemCode() != null) { throw new CodedException(X_INVALID_CLIENT_IDENTIFIER, "Redundant subsystem code"); } return ClientId.create(v.getXRoadInstance(), v.getMemberClass(), v.getMemberCode(), XRoadObjectType.MEMBER.equals(v.getObjectType()) ? null : v.getSubsystemCode()); }
IdentifierTypeConverter { static ClientId parseClientId(XRoadIdentifierType v) { if (XRoadObjectType.SUBSYSTEM.equals(v.getObjectType()) && v.getSubsystemCode() == null) { throw new CodedException(X_INVALID_CLIENT_IDENTIFIER, "Missing required subsystem code"); } if (XRoadObjectType.MEMBER.equals(v.getObjectType()) && v.getSubsystemCode() != null) { throw new CodedException(X_INVALID_CLIENT_IDENTIFIER, "Redundant subsystem code"); } return ClientId.create(v.getXRoadInstance(), v.getMemberClass(), v.getMemberCode(), XRoadObjectType.MEMBER.equals(v.getObjectType()) ? null : v.getSubsystemCode()); } }
IdentifierTypeConverter { static ClientId parseClientId(XRoadIdentifierType v) { if (XRoadObjectType.SUBSYSTEM.equals(v.getObjectType()) && v.getSubsystemCode() == null) { throw new CodedException(X_INVALID_CLIENT_IDENTIFIER, "Missing required subsystem code"); } if (XRoadObjectType.MEMBER.equals(v.getObjectType()) && v.getSubsystemCode() != null) { throw new CodedException(X_INVALID_CLIENT_IDENTIFIER, "Redundant subsystem code"); } return ClientId.create(v.getXRoadInstance(), v.getMemberClass(), v.getMemberCode(), XRoadObjectType.MEMBER.equals(v.getObjectType()) ? null : v.getSubsystemCode()); } private  IdentifierTypeConverter(); }
IdentifierTypeConverter { static ClientId parseClientId(XRoadIdentifierType v) { if (XRoadObjectType.SUBSYSTEM.equals(v.getObjectType()) && v.getSubsystemCode() == null) { throw new CodedException(X_INVALID_CLIENT_IDENTIFIER, "Missing required subsystem code"); } if (XRoadObjectType.MEMBER.equals(v.getObjectType()) && v.getSubsystemCode() != null) { throw new CodedException(X_INVALID_CLIENT_IDENTIFIER, "Redundant subsystem code"); } return ClientId.create(v.getXRoadInstance(), v.getMemberClass(), v.getMemberCode(), XRoadObjectType.MEMBER.equals(v.getObjectType()) ? null : v.getSubsystemCode()); } private  IdentifierTypeConverter();  }
IdentifierTypeConverter { static ClientId parseClientId(XRoadIdentifierType v) { if (XRoadObjectType.SUBSYSTEM.equals(v.getObjectType()) && v.getSubsystemCode() == null) { throw new CodedException(X_INVALID_CLIENT_IDENTIFIER, "Missing required subsystem code"); } if (XRoadObjectType.MEMBER.equals(v.getObjectType()) && v.getSubsystemCode() != null) { throw new CodedException(X_INVALID_CLIENT_IDENTIFIER, "Redundant subsystem code"); } return ClientId.create(v.getXRoadInstance(), v.getMemberClass(), v.getMemberCode(), XRoadObjectType.MEMBER.equals(v.getObjectType()) ? null : v.getSubsystemCode()); } private  IdentifierTypeConverter();   }