// Path: microservices-dashboard-server-core/src/main/java/be/ordina/msdashboard/applicationinstance/ApplicationInstance.java
// public final class ApplicationInstance {
// 
// 	private List<ApplicationEvent> changes = new ArrayList<>();
// 
// 	private final String id;
// 	private final String application;
// 	private final URI baseUri;
// 	private State state;
// 	private Status healthStatus = Status.UNKNOWN;
// 	private Links actuatorEndpoints = new Links();
// 
// 	private ApplicationInstance(Builder builder) {
// 		this.id = builder.id;
// 		this.application = builder.application;
// 		this.baseUri = builder.baseUri;
// 		this.state = State.CREATED;
// 		this.changes.add(new ApplicationInstanceCreated(this));
// 	}
// 
// 	public String getId() {
// 		return this.id;
// 	}
// 
// 	public String getApplication() {
// 		return this.application;
// 	}
// 
// 	public URI getBaseUri() {
// 		return this.baseUri;
// 	}
// 
// 	public Status getHealthStatus() {
// 		return this.healthStatus;
// 	}
// 
// 	void updateHealthStatus(Status healthStatus) {
// 		if (!this.healthStatus.equals(healthStatus)) {
// 			this.healthStatus = healthStatus;
// 			this.changes.add(new ApplicationInstanceHealthUpdated(this));
// 		}
// 	}
// 
// 	public Links getActuatorEndpoints() {
// 		return this.actuatorEndpoints;
// 	}
// 
// 	public boolean hasActuatorEndpointFor(String endpoint) {
// 		return this.actuatorEndpoints.hasLink(endpoint);
// 	}
// 
// 	public Optional<Link> getActuatorEndpoint(String endpoint) {
// 		return Optional.ofNullable(this.actuatorEndpoints.getLink(endpoint));
// 	}
// 
// 	void updateActuatorEndpoints(Links actuatorEndpoints) {
// 		if (!this.actuatorEndpoints.equals(actuatorEndpoints)) {
// 			this.actuatorEndpoints = actuatorEndpoints;
// 			this.changes.add(new ActuatorEndpointsUpdated(this));
// 		}
// 	}
// 
// 	public void delete() {
// 		if (this.state != State.DELETED) {
// 			this.state = State.DELETED;
// 			this.changes.add(new ApplicationInstanceDeleted(this));
// 		}
// 	}
// 
// 	public State getState() {
// 		return this.state;
// 	}
// 
// 	public List<ApplicationEvent> getUncommittedChanges() {
// 		return this.changes;
// 	}
// 
// 	public ApplicationInstance markChangesAsCommitted() {
// 		this.changes.clear();
// 		return this;
// 	}
// 
// 	/**
// 	 * Builder to create a new {@link ApplicationInstance application instance}.
// 	 *
// 	 * @author Tim Ysewyn
// 	 */
// 	static final class Builder {
// 
// 		private final String id;
// 		private final String application;
// 		private URI baseUri;
// 
// 		private Builder(String id, String application) {
// 			this.id = id;
// 			this.application = application;
// 		}
// 
// 		static Builder forApplicationWithId(String application, String id) {
// 			return new Builder(id, application);
// 		}
// 
// 		Builder baseUri(URI baseUri) {
// 			this.baseUri = baseUri;
// 			return this;
// 		}
// 
// 		ApplicationInstance build() {
// 			return new ApplicationInstance(this);
// 		}
// 
// 	}
// 
// 	/**
// 	 * Indicator of the state of an {@link ApplicationInstance application instance}.
// 	 */
// 	public enum State {
// 		/**
// 		 * Indicates that the {@link ApplicationInstance application instance} has been created.
// 		 */
// 		CREATED,
// 		/**
// 		 * Indicates that the {@link ApplicationInstance application instance} has been deleted.
// 		 */
// 		DELETED
// 	}
// }
// 
// Path: microservices-dashboard-server-core/src/test/java/be/ordina/msdashboard/applicationinstance/ApplicationInstanceMother.java
// public final class ApplicationInstanceMother {
// 
// 	private ApplicationInstanceMother() {
// 		throw new RuntimeException("Not allowed");
// 	}
// 
// 	public static ApplicationInstance instance(String id, String application) {
// 		return instance(id, application, URI.create("http://localhost:8080"));
// 	}
// 
// 	public static ApplicationInstance instance(String id, String application, URI baseUri) {
// 		return ApplicationInstance.Builder.forApplicationWithId(application, id).baseUri(baseUri).build();
// 	}
// 
// 	public static ApplicationInstance instance(String id, String application, URI baseUri, Links actuatorEndpoints) {
// 		ApplicationInstance applicationInstance = ApplicationInstance.Builder.forApplicationWithId(application, id)
// 				.baseUri(baseUri)
// 				.build();
// 		applicationInstance.updateActuatorEndpoints(actuatorEndpoints);
// 		return applicationInstance;
// 	}
// }


import org.junit.Test;
import be.ordina.msdashboard.applicationinstance.ApplicationInstance;
import be.ordina.msdashboard.applicationinstance.ApplicationInstanceMother;
import static org.assertj.core.api.Assertions.assertThat;
		catalogService.addApplicationToCatalog("a");
		Catalog catalog = catalogService.getCatalog();
		assertThat(catalog.getApplications()).hasSize(1);
		assertThat(catalog.getApplications()).contains("a");
	}

	@Test
	public void shouldRemoveKnownApplicationFromCatalog() {
		CatalogService catalogService = new CatalogService();
		catalogService.addApplicationToCatalog("a");
		catalogService.removeApplicationFromCatalog("a");
		Catalog catalog = catalogService.getCatalog();
		assertThat(catalog.getApplications()).isEmpty();
	}

	@Test
	public void shouldAddApplicationAndInstanceToEmptyCatalog() {
		ApplicationInstance applicationInstance = ApplicationInstanceMother.instance("a-1", "a");
		CatalogService catalogService = new CatalogService();
		catalogService.addApplicationInstanceToCatalog(applicationInstance);
		Catalog catalog = catalogService.getCatalog();
		assertThat(catalog.getApplications()).hasSize(1);
		assertThat(catalog.getApplications()).contains("a");
		assertThat(catalog.getApplicationInstances()).hasSize(1);
		assertThat(catalog.getApplicationInstancesForApplication("a")).hasSize(1);
		assertThat(catalog.getApplicationInstancesForApplication("a")).contains("a-1");
	}

	@Test
	public void shouldRemoveApplicationAndInstanceFromCatalog() {
// Path: microservices-dashboard-server-core/src/main/java/be/ordina/msdashboard/applicationinstance/ApplicationInstance.java
// public final class ApplicationInstance {
// 
// 	private List<ApplicationEvent> changes = new ArrayList<>();
// 
// 	private final String id;
// 	private final String application;
// 	private final URI baseUri;
// 	private State state;
// 	private Status healthStatus = Status.UNKNOWN;
// 	private Links actuatorEndpoints = new Links();
// 
// 	private ApplicationInstance(Builder builder) {
// 		this.id = builder.id;
// 		this.application = builder.application;
// 		this.baseUri = builder.baseUri;
// 		this.state = State.CREATED;
// 		this.changes.add(new ApplicationInstanceCreated(this));
// 	}
// 
// 	public String getId() {
// 		return this.id;
// 	}
// 
// 	public String getApplication() {
// 		return this.application;
// 	}
// 
// 	public URI getBaseUri() {
// 		return this.baseUri;
// 	}
// 
// 	public Status getHealthStatus() {
// 		return this.healthStatus;
// 	}
// 
// 	void updateHealthStatus(Status healthStatus) {
// 		if (!this.healthStatus.equals(healthStatus)) {
// 			this.healthStatus = healthStatus;
// 			this.changes.add(new ApplicationInstanceHealthUpdated(this));
// 		}
// 	}
// 
// 	public Links getActuatorEndpoints() {
// 		return this.actuatorEndpoints;
// 	}
// 
// 	public boolean hasActuatorEndpointFor(String endpoint) {
// 		return this.actuatorEndpoints.hasLink(endpoint);
// 	}
// 
// 	public Optional<Link> getActuatorEndpoint(String endpoint) {
// 		return Optional.ofNullable(this.actuatorEndpoints.getLink(endpoint));
// 	}
// 
// 	void updateActuatorEndpoints(Links actuatorEndpoints) {
// 		if (!this.actuatorEndpoints.equals(actuatorEndpoints)) {
// 			this.actuatorEndpoints = actuatorEndpoints;
// 			this.changes.add(new ActuatorEndpointsUpdated(this));
// 		}
// 	}
// 
// 	public void delete() {
// 		if (this.state != State.DELETED) {
// 			this.state = State.DELETED;
// 			this.changes.add(new ApplicationInstanceDeleted(this));
// 		}
// 	}
// 
// 	public State getState() {
// 		return this.state;
// 	}
// 
// 	public List<ApplicationEvent> getUncommittedChanges() {
// 		return this.changes;
// 	}
// 
// 	public ApplicationInstance markChangesAsCommitted() {
// 		this.changes.clear();
// 		return this;
// 	}
// 
// 	/**
// 	 * Builder to create a new {@link ApplicationInstance application instance}.
// 	 *
// 	 * @author Tim Ysewyn
// 	 */
// 	static final class Builder {
// 
// 		private final String id;
// 		private final String application;
// 		private URI baseUri;
// 
// 		private Builder(String id, String application) {
// 			this.id = id;
// 			this.application = application;
// 		}
// 
// 		static Builder forApplicationWithId(String application, String id) {
// 			return new Builder(id, application);
// 		}
// 
// 		Builder baseUri(URI baseUri) {
// 			this.baseUri = baseUri;
// 			return this;
// 		}
// 
// 		ApplicationInstance build() {
// 			return new ApplicationInstance(this);
// 		}
// 
// 	}
// 
// 	/**
// 	 * Indicator of the state of an {@link ApplicationInstance application instance}.
// 	 */
// 	public enum State {
// 		/**
// 		 * Indicates that the {@link ApplicationInstance application instance} has been created.
// 		 */
// 		CREATED,
// 		/**
// 		 * Indicates that the {@link ApplicationInstance application instance} has been deleted.
// 		 */
// 		DELETED
// 	}
// }
// 
// Path: microservices-dashboard-server-core/src/test/java/be/ordina/msdashboard/applicationinstance/ApplicationInstanceMother.java
// public final class ApplicationInstanceMother {
// 
// 	private ApplicationInstanceMother() {
// 		throw new RuntimeException("Not allowed");
// 	}
// 
// 	public static ApplicationInstance instance(String id, String application) {
// 		return instance(id, application, URI.create("http://localhost:8080"));
// 	}
// 
// 	public static ApplicationInstance instance(String id, String application, URI baseUri) {
// 		return ApplicationInstance.Builder.forApplicationWithId(application, id).baseUri(baseUri).build();
// 	}
// 
// 	public static ApplicationInstance instance(String id, String application, URI baseUri, Links actuatorEndpoints) {
// 		ApplicationInstance applicationInstance = ApplicationInstance.Builder.forApplicationWithId(application, id)
// 				.baseUri(baseUri)
// 				.build();
// 		applicationInstance.updateActuatorEndpoints(actuatorEndpoints);
// 		return applicationInstance;
// 	}
// }


// Path: microservices-dashboard-server-core/src/test/java/be/ordina/msdashboard/catalog/CatalogServiceTests.java
import org.junit.Test;
import be.ordina.msdashboard.applicationinstance.ApplicationInstance;
import be.ordina.msdashboard.applicationinstance.ApplicationInstanceMother;
import static org.assertj.core.api.Assertions.assertThat;

		catalogService.addApplicationToCatalog("a");
		Catalog catalog = catalogService.getCatalog();
		assertThat(catalog.getApplications()).hasSize(1);
		assertThat(catalog.getApplications()).contains("a");
	}

	@Test
	public void shouldRemoveKnownApplicationFromCatalog() {
		CatalogService catalogService = new CatalogService();
		catalogService.addApplicationToCatalog("a");
		catalogService.removeApplicationFromCatalog("a");
		Catalog catalog = catalogService.getCatalog();
		assertThat(catalog.getApplications()).isEmpty();
	}

	@Test
	public void shouldAddApplicationAndInstanceToEmptyCatalog() {
		ApplicationInstance applicationInstance = ApplicationInstanceMother.instance("a-1", "a");
		CatalogService catalogService = new CatalogService();
		catalogService.addApplicationInstanceToCatalog(applicationInstance);
		Catalog catalog = catalogService.getCatalog();
		assertThat(catalog.getApplications()).hasSize(1);
		assertThat(catalog.getApplications()).contains("a");
		assertThat(catalog.getApplicationInstances()).hasSize(1);
		assertThat(catalog.getApplicationInstancesForApplication("a")).hasSize(1);
		assertThat(catalog.getApplicationInstancesForApplication("a")).contains("a-1");
	}

	@Test
	public void shouldRemoveApplicationAndInstanceFromCatalog() {
		ApplicationInstance applicationInstance = ApplicationInstanceMother.instance("a-1", "a");