Skip to content

Commit

Permalink
Merge pull request #5 from plantbreeding/develop
Browse files Browse the repository at this point in the history
remove parent1 and parent2 objects, updated StringUtils
  • Loading branch information
daveneti authored Jun 13, 2024
2 parents c428c70 + 963b451 commit 1600b20
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 99 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public class StringUtils {
private static final Set<String> unpluralisables = ImmutableSet.of(
"equipment", "information", "rice", "money", "species", "series",
"fish", "sheep", "deer");
"fish", "sheep", "deer", "analysis");

private static final List<Replacer> singularisations = ImmutableList.of(
replace("(.*)people$").with("$1person"),
Expand All @@ -31,14 +31,14 @@ public class StringUtils {
replace("(.+)zes$").with("$1"),
replace("([m|l])ice$").with("$1ouse"),
replace("(.+)matrices$").with("$1matrix"),
replace("(.+)Matrices$").with("$1Matrix"),
replace("indices$").with("index"),
replace("(.+[^aeiou])ices$").with("$1ice"),
replace("(.*)ices$").with("$1ex"),
replace("(octop|vir)i$").with("$1us"),
replace("bases$").with("base"),
replace("(.+(s|x|sh|ch))es$").with("$1"),
replace("(.+)s$").with("$1"),
replace("analysis$").with("analysis$")
replace("(.+)s$").with("$1")
);

private static final List<Replacer> pluralisations = ImmutableList.of(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package org.brapi.schematools.core.utils;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

class StringUtilsTest {

@Test
void toSingular() {
assertEquals("DataMatrix", StringUtils.toSingular("DataMatrices")) ;
assertEquals("Analysis", StringUtils.toSingular("Analysis")) ;
}

@Test
void toPlural() {
assertEquals("DataMatrices", StringUtils.toPlural("DataMatrix")) ;
}

@Test
void makeValidName() {
}

@Test
void toSentenceCase() {
}

@Test
void toParameterCase() {
}

@Test
void startsWithLowerCase() {
}

@Test
void startsWithUpperCase() {
}

@Test
void replace() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,104 +41,12 @@
]
},
"parent1": {
"properties": {
"germplasmDbId": {
"description": "the unique identifier for a germplasm",
"type": [
"null",
"string"
]
},
"germplasmName": {
"description": "the human readable name for a germplasm",
"type": [
"null",
"string"
]
},
"observationUnitDbId": {
"description": "the unique identifier for an observation unit",
"type": [
"null",
"string"
]
},
"observationUnitName": {
"description": "the human readable name for an observation unit",
"type": [
"null",
"string"
]
},
"parentType": {
"description": "The type of parent ex. 'MALE', 'FEMALE', 'SELF', 'POPULATION', etc.",
"enum": [
"MALE",
"FEMALE",
"SELF",
"POPULATION",
null
],
"type": [
"null",
"string"
]
}
},
"type": [
"null",
"object"
]
"$ref": "CrossParent.json#/$defs/CrossParent",
"description": "the first parent used in the cross"
},
"parent2": {
"properties": {
"germplasmDbId": {
"description": "the unique identifier for a germplasm",
"type": [
"null",
"string"
]
},
"germplasmName": {
"description": "the human readable name for a germplasm",
"type": [
"null",
"string"
]
},
"observationUnitDbId": {
"description": "the unique identifier for an observation unit",
"type": [
"null",
"string"
]
},
"observationUnitName": {
"description": "the human readable name for an observation unit",
"type": [
"null",
"string"
]
},
"parentType": {
"description": "The type of parent ex. 'MALE', 'FEMALE', 'SELF', 'POPULATION', etc.",
"enum": [
"MALE",
"FEMALE",
"SELF",
"POPULATION",
null
],
"type": [
"null",
"string"
]
}
},
"type": [
"null",
"object"
]
"$ref": "CrossParent.json#/$defs/CrossParent",
"description": "the second parent used in the cross"
},
"plannedCrossDbId": {
"description": "the unique identifier for a planned cross",
Expand Down

0 comments on commit 1600b20

Please sign in to comment.