This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PersonTest { | |
@Test | |
void testWhenPersonFetchedRecordComponentsNotNull() { | |
Map<String, Object> fetchedPerson = PersonHttpUtil.fetchPerson(); | |
Person person = Person.from(fetchedPerson); | |
assertThat(person, notNullValue()); | |
assertThat(person.email(), is(not(emptyOrNullString()))); | |
assertThat(person.fullName(), notNullValue()); | |
assertThat(person.fullName().first(), is(not(emptyOrNullString()))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@JsonIgnoreProperties(ignoreUnknown = true) | |
public record Person( | |
@JsonProperty("gender") String gender, | |
@JsonProperty("name") Name fullName, | |
@JsonProperty("email") String email) { | |
public static Person from(Map<String, Object> personMap) { | |
return new ObjectMapper().convertValue(personMap, Person.class); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public record EmailData( | |
String recipient, | |
String subject, | |
String message, | |
Set<EmailAttachment> emailAttachments) { | |
public EmailData { | |
Objects.requireNonNull(recipient); | |
subject = Objects.requireNonNullElse(subject, ""); | |
message = Objects.requireNonNullElse(message, ""); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Value | |
public class EmailData { | |
String recipient; | |
String subject; | |
String message; | |
Set<EmailAttachment> attachments; | |
@JsonIgnore | |
public boolean hasAttachments() { | |
return (attachments != null && !attachments.isEmpty()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EmailData { | |
private final String recipient; | |
private final String subject; | |
private final String message; | |
private final Set<EmailAttachment> emailAttachments; | |
public EmailData() { | |
} | |
public String getRecipient() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@FunctionName("download") | |
@StorageAccount("<STORAGE-ACCOUNT-NAME-FROM-THIS-DEPLOYED-FUNCTION") | |
public HttpResponseMessage downloadFile( | |
@HttpTrigger( | |
name = "req", | |
methods = {HttpMethod.GET}, | |
authLevel = AuthorizationLevel.ANONYMOUS) | |
HttpRequestMessage<Optional<String>> request, | |
@BlobInput( | |
name = "filename", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@FunctionName("download") | |
public HttpResponseMessage downloadFile( | |
@HttpTrigger( | |
name = "req", | |
methods = {HttpMethod.GET, HttpMethod.POST}, | |
authLevel = AuthorizationLevel.ANONYMOUS) | |
HttpRequestMessage<Optional<String>> request, | |
final ExecutionContext context) { | |
context.getLogger().info("FileDownloadHttpTrigger processed a request."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
postgres: | |
image: postgres:12 | |
environment: | |
POSTGRES_USER: cadence | |
POSTGRES_PASSWORD: cadence | |
ports: | |
- "5432:5432" | |
cadence: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import Search from "./components/search/Search"; | |
import "./style.css" | |
function App() { | |
return ( | |
<div> | |
<Search /> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import Avatar from "../avatar/Avatar" | |
function Profile(props) { | |
return ( | |
<div className="container"> | |
<Avatar | |
avatarData = {{imageUrl: props.avatar_url, | |
imageAlt: props.login}} |
NewerOlder