Skip to content

Commit

Permalink
spotless
Browse files Browse the repository at this point in the history
Signed-off-by: Antoine MAZEAS <[email protected]>
  • Loading branch information
antoinemzs committed Jan 13, 2025
1 parent 8246a4d commit ae891b3
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 165 deletions.

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions openbas-api/src/test/java/io/openbas/utils/fixtures/Store.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import java.util.List;
import java.util.function.Supplier;

public class Store<T>{
public List<T> items = new ArrayList<>();
public class Store<T> {
public List<T> items = new ArrayList<>();

public T memorise(Supplier<T> f) {
T result = f.get();
items.add(result);
return result;
}
public T memorise(Supplier<T> f) {
T result = f.get();
items.add(result);
return result;
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package io.openbas.utils.fixtures;

import io.openbas.database.model.Variable;

import java.util.UUID;

public class VariableFixture {
public static Variable getVariable() {
Variable var = new Variable();
var.setId(UUID.randomUUID().toString());
var.setKey("variable_key");
var.setValue("variable value");
var.setDescription("variable description");
return var;
}
public static Variable getVariable() {
Variable var = new Variable();
var.setId(UUID.randomUUID().toString());
var.setKey("variable_key");
var.setValue("variable value");
var.setDescription("variable description");
return var;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.openbas.utils.fixtures.composers;

import io.openbas.database.model.Article;
import io.openbas.database.model.Challenge;
import io.openbas.database.model.Tag;
import io.openbas.database.repository.ChallengeRepository;
Expand All @@ -11,7 +10,7 @@
import org.springframework.stereotype.Component;

@Component
public class ChallengeComposer extends ComposerBase<Challenge> {
public class ChallengeComposer extends ComposerBase<Challenge> {
@Autowired private ChallengeRepository challengeRepository;

public class Composer extends InnerComposerBase<Challenge> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package io.openbas.utils.fixtures.composers;

import io.openbas.database.model.Document;

import java.util.ArrayList;
import java.util.List;

public class ComposerBase<T> {
public List<T> generatedItems = new ArrayList<>();
public List<T> generatedItems = new ArrayList<>();

public void reset() {
generatedItems.clear();
}
public void reset() {
generatedItems.clear();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Component
public class TagComposer extends ComposerBase<Tag> {
@Autowired private TagRepository tagRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,31 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Component
public class VariableComposer extends ComposerBase<Variable> {
@Autowired private VariableRepository variableRepository;

public class Composer extends InnerComposerBase<Variable> {
private final Variable variable;
@Autowired private VariableRepository variableRepository;

public Composer(Variable variable) {
this.variable = variable;
}
public class Composer extends InnerComposerBase<Variable> {
private final Variable variable;

@Override
public Composer persist() {
variableRepository.save(variable);
return this;
}
public Composer(Variable variable) {
this.variable = variable;
}

@Override
public Variable get() {
return this.variable;
}
@Override
public Composer persist() {
variableRepository.save(variable);
return this;
}

public Composer forVariable(Variable variable) {
generatedItems.add(variable);
return new Composer(variable);
@Override
public Variable get() {
return this.variable;
}
}

public Composer forVariable(Variable variable) {
generatedItems.add(variable);
return new Composer(variable);
}
}

0 comments on commit ae891b3

Please sign in to comment.