Skip to content

Commit

Permalink
Fixed problems regarding the new attributes in the question
Browse files Browse the repository at this point in the history
  • Loading branch information
UO289845 committed Apr 1, 2024
1 parent 52f85dc commit 964a123
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.wikidata.wdtk.wikibaseapi.apierrors.MediaWikiApiErrorException;

import main.java.questionGenerator.question.Question;
import main.java.questionGenerator.question.QuestionType;

public abstract class AbstractGenerator {

Expand All @@ -29,7 +30,7 @@ public abstract class AbstractGenerator {
private QuestionType type;

private static final String MESSAGES_PATH = "messages";
public AbstractGenerator(String propertyId) {
public AbstractGenerator(String propertyId, QuestionType type) {
this.propertyId = propertyId;
this.type = type;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
import org.wikidata.wdtk.datamodel.interfaces.Value;
import org.wikidata.wdtk.wikibaseapi.apierrors.MediaWikiApiErrorException;

import main.java.questionGenerator.question.QuestionType;

public abstract class RightAnswerIsEntity extends AbstractGenerator {

public RightAnswerIsEntity(String propertyId) {
super(propertyId);
public RightAnswerIsEntity(String propertyId, QuestionType type) {
super(propertyId, type);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main.java.questionGenerator.generator.specificGenerators;

import main.java.questionGenerator.generator.RightAnswerIsEntity;
import main.java.questionGenerator.question.QuestionType;

public class CapitalGenerator extends RightAnswerIsEntity {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main.java.questionGenerator.generator.specificGenerators;

import main.java.questionGenerator.generator.RightAnswerIsEntity;
import main.java.questionGenerator.question.QuestionType;

public class LanguageGenerator extends RightAnswerIsEntity {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.wikidata.wdtk.datamodel.interfaces.Value;

import main.java.questionGenerator.generator.AbstractGenerator;
import main.java.questionGenerator.question.QuestionType;

public class PopulationGenerator extends AbstractGenerator {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.wikidata.wdtk.datamodel.interfaces.Value;

import main.java.questionGenerator.generator.AbstractGenerator;
import main.java.questionGenerator.question.QuestionType;

public class SizeGenerator extends AbstractGenerator {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.junit.jupiter.api.Test;

import main.java.questionGenerator.question.Question;
import main.java.questionGenerator.question.QuestionType;

public class QuestionTests {

Expand All @@ -21,7 +22,7 @@ public class QuestionTests {
@BeforeEach
void setUp() {
List<String> answers = Arrays.asList("A", "B", "C");
question = new Question("What is the capital of France?", answers);
question = new Question("What is the capital of France?", answers, "en", QuestionType.CAPITAL);
}

@Test
Expand Down

0 comments on commit 964a123

Please sign in to comment.