-
Notifications
You must be signed in to change notification settings - Fork 24
feat: adds ValueConverter utility and demo samples #108
Conversation
Codecov Report
@@ Coverage Diff @@
## master #108 +/- ##
=============================================
- Coverage 76.57% 64.57% -12.00%
+ Complexity 606 530 -76
=============================================
Files 48 49 +1
Lines 5617 3263 -2354
Branches 69 14 -55
=============================================
- Hits 4301 2107 -2194
+ Misses 1227 1077 -150
+ Partials 89 79 -10 Continue to review full report at Codecov.
|
...oud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/utility/ValueConverter.java
Outdated
Show resolved
Hide resolved
...oud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/utility/ValueConverter.java
Outdated
Show resolved
Hide resolved
...e-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/utility/ValueConverterTest.java
Outdated
Show resolved
Hide resolved
...e-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/utility/ValueConverterTest.java
Outdated
Show resolved
Hide resolved
...e-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/utility/ValueConverterTest.java
Outdated
Show resolved
Hide resolved
...e-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/utility/ValueConverterTest.java
Outdated
Show resolved
Hide resolved
Warning: This pull request is touching the following templated files:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a test for the bad input case as well?
...e-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/utility/ValueConverterTest.java
Outdated
Show resolved
Hide resolved
* limitations under the License. | ||
*/ | ||
|
||
package com.google.cloud.aiplatform.utility; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: most other utility packages use util
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
if (key.contains("multiLabel")) { | ||
actualBoolValueEntry = entry; | ||
} else if (key.contains("modelType")) { | ||
actualStringValueEntry = entry; | ||
} else if (key.contains("budgetMilliNodeHours")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should these checks for key name use equals
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
} | ||
|
||
Value actualBoolValue = (Value) actualBoolValueEntry.getValue(); | ||
Assert.assertEquals(testObjectInputs.getMultiLabel(), actualBoolValue.getBoolValue()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: usually Assert.assertEquals
is statically imported
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
private static AutoMlImageClassificationInputs testObjectInputs; | ||
|
||
@Before | ||
public void setUp() throws InvalidProtocolBufferException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything in this setup is only used in the one test - you can move it inside there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/util/ValueConverterTest.java
Outdated
Show resolved
Hide resolved
…orm/util/ValueConverterTest.java Co-authored-by: yoshi-code-bot <[email protected]>
This PR includes the following:
ValueConverter
class, that provides methods for convertingMessage
types to/fromprotobuf.Value
objectsValueConverter
class