@Test public void shouldTransform() { ServerInfo info = transformerUnderTest.transform(mServerInfoData); assertThat(info.getBuild(), is("20150527_1447")); assertThat(info.getDateFormatPattern(), is(new SimpleDateFormat("yyyy-MM-dd"))); assertThat(info.getDatetimeFormatPattern(), is(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"))); assertThat(info.getVersion(), is(ServerVersion.v6_1)); assertThat(info.isEditionPro(), is(true)); assertThat(info.getEditionName(), is("Enterprise for AWS")); assertThat(info.getFeatures(), contains("Fusion")); assertThat(info.getLicenseType(), is("Type")); }
public ServerInfo transform(ServerInfoData response) { ServerInfo serverInfo = new ServerInfo(); serverInfo.setBuild(response.getBuild()); SimpleDateFormat dateDateFormat = new SimpleDateFormat(response.getDateFormatPattern()); serverInfo.setDateFormatPattern(dateDateFormat); SimpleDateFormat dateTimeFormat = new SimpleDateFormat(response.getDatetimeFormatPattern()); serverInfo.setDatetimeFormatPattern(dateTimeFormat); ServerVersion version = ServerVersion.valueOf(response.getVersion()); serverInfo.setVersion(version); serverInfo.setEdition(response.getEdition()); serverInfo.setEditionName(response.getEditionName()); Set<String> features = parseFeatureSet(response.getFeatures()); serverInfo.setFeatures(features); serverInfo.setLicenseType(response.getLicenseType()); return serverInfo; }
ServerInfoTransformer { public ServerInfo transform(ServerInfoData response) { ServerInfo serverInfo = new ServerInfo(); serverInfo.setBuild(response.getBuild()); SimpleDateFormat dateDateFormat = new SimpleDateFormat(response.getDateFormatPattern()); serverInfo.setDateFormatPattern(dateDateFormat); SimpleDateFormat dateTimeFormat = new SimpleDateFormat(response.getDatetimeFormatPattern()); serverInfo.setDatetimeFormatPattern(dateTimeFormat); ServerVersion version = ServerVersion.valueOf(response.getVersion()); serverInfo.setVersion(version); serverInfo.setEdition(response.getEdition()); serverInfo.setEditionName(response.getEditionName()); Set<String> features = parseFeatureSet(response.getFeatures()); serverInfo.setFeatures(features); serverInfo.setLicenseType(response.getLicenseType()); return serverInfo; } }
ServerInfoTransformer { public ServerInfo transform(ServerInfoData response) { ServerInfo serverInfo = new ServerInfo(); serverInfo.setBuild(response.getBuild()); SimpleDateFormat dateDateFormat = new SimpleDateFormat(response.getDateFormatPattern()); serverInfo.setDateFormatPattern(dateDateFormat); SimpleDateFormat dateTimeFormat = new SimpleDateFormat(response.getDatetimeFormatPattern()); serverInfo.setDatetimeFormatPattern(dateTimeFormat); ServerVersion version = ServerVersion.valueOf(response.getVersion()); serverInfo.setVersion(version); serverInfo.setEdition(response.getEdition()); serverInfo.setEditionName(response.getEditionName()); Set<String> features = parseFeatureSet(response.getFeatures()); serverInfo.setFeatures(features); serverInfo.setLicenseType(response.getLicenseType()); return serverInfo; } private  ServerInfoTransformer(); }
ServerInfoTransformer { public ServerInfo transform(ServerInfoData response) { ServerInfo serverInfo = new ServerInfo(); serverInfo.setBuild(response.getBuild()); SimpleDateFormat dateDateFormat = new SimpleDateFormat(response.getDateFormatPattern()); serverInfo.setDateFormatPattern(dateDateFormat); SimpleDateFormat dateTimeFormat = new SimpleDateFormat(response.getDatetimeFormatPattern()); serverInfo.setDatetimeFormatPattern(dateTimeFormat); ServerVersion version = ServerVersion.valueOf(response.getVersion()); serverInfo.setVersion(version); serverInfo.setEdition(response.getEdition()); serverInfo.setEditionName(response.getEditionName()); Set<String> features = parseFeatureSet(response.getFeatures()); serverInfo.setFeatures(features); serverInfo.setLicenseType(response.getLicenseType()); return serverInfo; } private  ServerInfoTransformer(); static ServerInfoTransformer get(); ServerInfo transform(ServerInfoData response); }
ServerInfoTransformer { public ServerInfo transform(ServerInfoData response) { ServerInfo serverInfo = new ServerInfo(); serverInfo.setBuild(response.getBuild()); SimpleDateFormat dateDateFormat = new SimpleDateFormat(response.getDateFormatPattern()); serverInfo.setDateFormatPattern(dateDateFormat); SimpleDateFormat dateTimeFormat = new SimpleDateFormat(response.getDatetimeFormatPattern()); serverInfo.setDatetimeFormatPattern(dateTimeFormat); ServerVersion version = ServerVersion.valueOf(response.getVersion()); serverInfo.setVersion(version); serverInfo.setEdition(response.getEdition()); serverInfo.setEditionName(response.getEditionName()); Set<String> features = parseFeatureSet(response.getFeatures()); serverInfo.setFeatures(features); serverInfo.setLicenseType(response.getLicenseType()); return serverInfo; } private  ServerInfoTransformer(); static ServerInfoTransformer get(); ServerInfo transform(ServerInfoData response);  }