Skip to content

Commit

Permalink
Merge pull request #267 from Project-MONAI/AI-185
Browse files Browse the repository at this point in the history
adding missed validation and new test so it dont happen again
  • Loading branch information
neildsouth authored Dec 14, 2023
2 parents 086ec7d + 787d025 commit b700454
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ jobs:
unit-test:
runs-on: ubuntu-latest
steps:
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'

- uses: actions/setup-dotnet@v3
with:
Expand Down
1 change: 1 addition & 0 deletions src/Messaging/Common/ArtifactTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public static class ArtifactTypes
{
{ ArtifactType.Unset, "Unset" },
{ ArtifactType.Folder, "Folders" },
{ ArtifactType.HL7, "HL7 message" },
{ ArtifactType.AR, "Autorefract" },
{ ArtifactType.ASMT, "Content Assessment Results" },
{ ArtifactType.AU, "Audio" },
Expand Down
23 changes: 23 additions & 0 deletions src/Messaging/Tests/Common/ArtifactTypesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

using System;
using Monai.Deploy.Messaging.Common;
using Xunit;

Expand All @@ -32,5 +33,27 @@ public void ArtifactTypeInvalid_ShouldReturnFalse()
{
Assert.False(ArtifactTypes.Validate("false"));
}

[Fact]
public void ArtifactTypeNull_ShouldReturnFalse()
{
Assert.False(ArtifactTypes.Validate(null));

Check warning on line 40 in src/Messaging/Tests/Common/ArtifactTypesTests.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Cannot convert null literal to non-nullable reference type.

Check warning on line 40 in src/Messaging/Tests/Common/ArtifactTypesTests.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Cannot convert null literal to non-nullable reference type.

Check warning on line 40 in src/Messaging/Tests/Common/ArtifactTypesTests.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Cannot convert null literal to non-nullable reference type.

Check warning on line 40 in src/Messaging/Tests/Common/ArtifactTypesTests.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Cannot convert null literal to non-nullable reference type.

Check warning on line 40 in src/Messaging/Tests/Common/ArtifactTypesTests.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Cannot convert null literal to non-nullable reference type.

Check warning on line 40 in src/Messaging/Tests/Common/ArtifactTypesTests.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Cannot convert null literal to non-nullable reference type.

Check warning on line 40 in src/Messaging/Tests/Common/ArtifactTypesTests.cs

View workflow job for this annotation

GitHub Actions / unit-test

Cannot convert null literal to non-nullable reference type.

Check warning on line 40 in src/Messaging/Tests/Common/ArtifactTypesTests.cs

View workflow job for this annotation

GitHub Actions / unit-test

Cannot convert null literal to non-nullable reference type.

Check warning on line 40 in src/Messaging/Tests/Common/ArtifactTypesTests.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Cannot convert null literal to non-nullable reference type.

Check warning on line 40 in src/Messaging/Tests/Common/ArtifactTypesTests.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Cannot convert null literal to non-nullable reference type.

Check warning on line 40 in src/Messaging/Tests/Common/ArtifactTypesTests.cs

View workflow job for this annotation

GitHub Actions / analyze (csharp)

Cannot convert null literal to non-nullable reference type.

Check warning on line 40 in src/Messaging/Tests/Common/ArtifactTypesTests.cs

View workflow job for this annotation

GitHub Actions / analyze (csharp)

Cannot convert null literal to non-nullable reference type.

Check warning on line 40 in src/Messaging/Tests/Common/ArtifactTypesTests.cs

View workflow job for this annotation

GitHub Actions / analyze (csharp)

Cannot convert null literal to non-nullable reference type.

Check warning on line 40 in src/Messaging/Tests/Common/ArtifactTypesTests.cs

View workflow job for this annotation

GitHub Actions / analyze (csharp)

Cannot convert null literal to non-nullable reference type.
}

[Fact]
public void ArtifactTypes_Should_Contain_All()
{
foreach (var artifactType in Enum.GetValues(typeof(ArtifactType)))
{
Assert.True(ArtifactTypes.ListOfModularity.ContainsKey((ArtifactType)artifactType));
}
}

[Fact]
public void ArtifactTypes_Should_Contain_Same_Count()
{
Assert.Equal(ArtifactTypes.ListOfModularity.Count, Enum.GetValues(typeof(ArtifactType)).Length);
}

}
}

0 comments on commit b700454

Please sign in to comment.